RED-2800: Password policy error message

This commit is contained in:
Adina Țeudan 2021-11-24 20:42:09 +02:00
parent 337a995952
commit 16750eff89
3 changed files with 22 additions and 16 deletions

View File

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

View File

@ -733,8 +733,7 @@
"assigned-to-me": "Assigned to me",
"assigned-to-others": "Assigned to others",
"recent": "Recent ({hours} h)",
"unassigned": "Unassigned",
"new": "New"
"unassigned": "Unassigned"
},
"reanalyse-dossier": {
"error": "Failed to schedule files for reanalysis. Please try again.",
@ -1093,12 +1092,12 @@
"error": "Re-processing required",
"full-reprocess": "Processing",
"indexing": "Processing",
"new": "New",
"ocr-processing": "OCR Processing",
"processed": "Processed",
"processing": "Processing...",
"reprocess": "Processing",
"unassigned": "Unassigned",
"new": "New",
"under-approval": "Under Approval",
"under-review": "Under Review",
"unprocessed": "Unprocessed"
@ -1189,7 +1188,6 @@
},
"initials-avatar": {
"unassigned": "Unassigned",
"new": "New",
"you": "You"
},
"justifications": "Justifications",
@ -1438,6 +1436,9 @@
"cancel": "Cancel",
"save": "Save"
},
"error": {
"password-policy": "Failed to reset password. The new password doesn't match the password policy."
},
"form": {
"password": "Temporary password"
},

View File

@ -103,7 +103,6 @@ export class File extends Entity<IFile> implements IFile {
this.isProcessing = isProcessingStatuses.includes(this.processingStatus);
this.isApproved = this.workflowStatus === WorkflowFileStatuses.APPROVED;
this.isNew = this.workflowStatus === WorkflowFileStatuses.NEW;
// this.isUnassigned = !this.assignee;
this.isUnderReview = this.workflowStatus === WorkflowFileStatuses.UNDER_REVIEW;
this.isUnderApproval = this.workflowStatus === WorkflowFileStatuses.UNDER_APPROVAL;
this.canBeApproved = !this.analysisRequired && !this.hasSuggestions;