|
|
@ -333,22 +333,24 @@ export class SecurityComponent extends PageComponent implements OnInit, OnDestro |
|
|
onChangePassword(form: FormGroupDirective): void { |
|
|
onChangePassword(form: FormGroupDirective): void { |
|
|
if (this.changePassword.valid) { |
|
|
if (this.changePassword.valid) { |
|
|
this.authService.changePassword(this.changePassword.get('currentPassword').value, |
|
|
this.authService.changePassword(this.changePassword.get('currentPassword').value, |
|
|
this.changePassword.get('newPassword').value, {ignoreErrors: true}).subscribe(() => { |
|
|
this.changePassword.get('newPassword').value, {ignoreErrors: true}).subscribe({ |
|
|
this.discardChanges(form); |
|
|
next: () => { |
|
|
}, |
|
|
this.discardChanges(form); |
|
|
(error) => { |
|
|
}, |
|
|
if (error.status === 400 && error.error.message === 'Current password doesn\'t match!') { |
|
|
error: (error) => { |
|
|
this.changePassword.get('currentPassword').setErrors({differencePassword: true}); |
|
|
if (error.status === 400 && error.error.message === 'Current password doesn\'t match!') { |
|
|
} else if (error.status === 400 && error.error.message.startsWith('Password must')) { |
|
|
this.changePassword.get('currentPassword').setErrors({ differencePassword: true }); |
|
|
this.loadPasswordPolicy(); |
|
|
} else if (error.status === 400 && error.error.message.startsWith('Password must')) { |
|
|
} else if (error.status === 400 && error.error.message.startsWith('Password was already used')) { |
|
|
this.loadPasswordPolicy(); |
|
|
this.changePassword.get('newPassword').setErrors({alreadyUsed: error.error.message}); |
|
|
} else if (error.status === 400 && error.error.message.startsWith('Password was already used')) { |
|
|
} else { |
|
|
this.changePassword.get('newPassword').setErrors({ alreadyUsed: error.error.message }); |
|
|
this.store.dispatch(new ActionNotificationShow({ |
|
|
} else { |
|
|
message: error.error.message, |
|
|
this.store.dispatch(new ActionNotificationShow({ |
|
|
type: 'error', |
|
|
message: error.error.message, |
|
|
target: 'changePassword' |
|
|
type: 'error', |
|
|
})); |
|
|
target: 'changePassword' |
|
|
|
|
|
})); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
|