RED-8209: fixed wrong error message upon password reset.

This commit is contained in:
Nicoleta Panaghiu 2024-01-16 15:18:10 +02:00
parent ee3dd12f80
commit 92bf6228a7
5 changed files with 11 additions and 29 deletions

View File

@ -1,9 +1,8 @@
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { Component, EventEmitter, Input, Output } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { UserService } from '@users/user.service'; import { UserService } from '@users/user.service';
import { IconButtonTypes, LoadingService, Toaster } from '@iqser/common-ui'; import { IconButtonTypes, LoadingService } from '@iqser/common-ui';
import { User } from '@red/domain'; import { User } from '@red/domain';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { firstValueFrom } from 'rxjs'; import { firstValueFrom } from 'rxjs';
@Component({ @Component({
@ -20,25 +19,20 @@ export class ResetPasswordComponent {
private readonly _formBuilder: UntypedFormBuilder, private readonly _formBuilder: UntypedFormBuilder,
private readonly _userService: UserService, private readonly _userService: UserService,
private readonly _loadingService: LoadingService, private readonly _loadingService: LoadingService,
private readonly _toaster: Toaster,
) {} ) {}
async save() { async save() {
this._loadingService.start(); this._loadingService.start();
try { await firstValueFrom(
await firstValueFrom( this._userService.resetPassword(
this._userService.resetPassword( {
{ password: this.form.get('temporaryPassword').value,
password: this.form.get('temporaryPassword').value, temporary: true,
temporary: true, },
}, this.user.id,
this.user.id, ),
), );
); this.toggleResetPassword.emit();
this.toggleResetPassword.emit();
} catch (error) {
this._toaster.error(_('reset-password-dialog.error.password-policy'));
}
this._loadingService.stop(); this._loadingService.stop();
} }

View File

@ -2132,9 +2132,6 @@
"cancel": "Abbrechen", "cancel": "Abbrechen",
"save": "Speichern" "save": "Speichern"
}, },
"error": {
"password-policy": "Kennwort konnte nicht zurückgesetzt werden. Das neue Passwort entspricht nicht der Passwortrichtlinie."
},
"form": { "form": {
"password": "Temporäres Passwort" "password": "Temporäres Passwort"
}, },

View File

@ -2132,9 +2132,6 @@
"cancel": "Cancel", "cancel": "Cancel",
"save": "Save" "save": "Save"
}, },
"error": {
"password-policy": "Failed to reset password. The new password doesn't match the password policy."
},
"form": { "form": {
"password": "Temporary password" "password": "Temporary password"
}, },

View File

@ -2132,9 +2132,6 @@
"cancel": "Abbrechen", "cancel": "Abbrechen",
"save": "Speichern" "save": "Speichern"
}, },
"error": {
"password-policy": "Kennwort konnte nicht zurückgesetzt werden. Das neue Passwort entspricht nicht der Passwortrichtlinie."
},
"form": { "form": {
"password": "Temporäres Passwort" "password": "Temporäres Passwort"
}, },

View File

@ -2132,9 +2132,6 @@
"cancel": "Cancel", "cancel": "Cancel",
"save": "Save" "save": "Save"
}, },
"error": {
"password-policy": "Failed to reset password. The new password doesn't match the password policy."
},
"form": { "form": {
"password": "Temporary password" "password": "Temporary password"
}, },