mirror of
https://github.com/mmumshad/ansible-playable.git
synced 2025-02-15 04:42:05 +00:00
36 lines
711 B
JavaScript
36 lines
711 B
JavaScript
'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 = '';
|
|
});
|
|
}
|
|
}
|
|
}
|