-
Notifications
You must be signed in to change notification settings - Fork 0
/
changepwd.js
24 lines (22 loc) · 932 Bytes
/
changepwd.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
angular.module('app')
.controller('ChangePwdCtrl', function ($scope, $auth,Account) {
$scope.changePassword = function () {
// if ($scope.user.newpwd == $scope.user.cnewpwd) {
$scope.passwords = {};
$scope.passwords.new = $scope.user.newpwd;
$scope.passwords.old = $scope.user.oldpwd;
Account.updatePassword($scope.passwords)
.then(function () {
window.alert('Profile has been updated');
});
};
$scope.validate = function () {
$scope.changeForm.cnewpwd.$setValidity("notsame",false);
if ($scope.user.newpwd == $scope.user.cnewpwd) {
$scope.changeForm.cnewpwd.$setValidity("notsame",true);
}
else{
$scope.changeForm.cnewpwd.$setValidity("notsame",false);
}
}
});