mirror of
https://github.com/mmumshad/ansible-playable.git
synced 2025-03-09 23:38:54 +00:00
Initial Commit
This commit is contained in:
commit
c92f737237
273 changed files with 16964 additions and 0 deletions
36
client/app/account/settings/settings.controller.js
Normal file
36
client/app/account/settings/settings.controller.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
'use strict';
|
||||
|
||||
export default class SettingsController {
|
||||
user = {
|
||||
oldPassword: '',
|
||||
newPassword: '',
|
||||
confirmPassword: ''
|
||||
};
|
||||
errors = {
|
||||
other: undefined
|
||||
};
|
||||
message = '';
|
||||
submitted = false;
|
||||
|
||||
|
||||
/*@ngInject*/
|
||||
constructor(Auth) {
|
||||
this.Auth = Auth;
|
||||
}
|
||||
|
||||
changePassword(form) {
|
||||
this.submitted = true;
|
||||
|
||||
if(form.$valid) {
|
||||
this.Auth.changePassword(this.user.oldPassword, this.user.newPassword)
|
||||
.then(() => {
|
||||
this.message = 'Password successfully changed.';
|
||||
})
|
||||
.catch(() => {
|
||||
form.password.$setValidity('mongoose', false);
|
||||
this.errors.other = 'Incorrect password';
|
||||
this.message = '';
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue