refs #6427 feat: front updates

This commit is contained in:
Javier Segarra 2024-03-26 08:20:04 +01:00
parent 2ae298cd9e
commit b7f39b45ab
1 changed files with 4 additions and 10 deletions

View File

@ -18,19 +18,13 @@ export default class Controller {
$scope.$ctrl.sms = isSms;
});
}
// ONLY FOR TESTS
// $onInit() {
// this.$scope.$ctrl.sms = true;
// this.$scope.$ctrl.userId = '9';
// this.$scope.$ctrl.user = '432978106';
// }
goToLogin() {
this.vnApp.showSuccess(this.$translate.instant('Notification sent!'));
this.$state.go('login');
}
goToChangePassword({valid: isValid, token}) {
if (!isValid)
goToChangePassword({token}) {
if (!token)
this.vnApp.showError(this.$translate.instant('Invalid login'));
else {
this.$state.params.userId = this.userId;
@ -40,7 +34,7 @@ export default class Controller {
goToOTP(otp) {
this.otp = true;
this.$state.params.otp = otp;
this.code = otp;
this.code = null;
}
submit() {
@ -51,7 +45,7 @@ export default class Controller {
this.$http.post('VnUsers/recoverPasswordSMS', {id: this.userId, phone: this.user, otp: this.code})
.then(({data}) => {
data.otp && this.goToOTP(data.otp);
data.valid && this.goToChangePassword(data);
data.token && this.goToChangePassword(data);
});
} else {
this.$http.post('VnUsers/recoverPassword', {user: this.user})