Commit ddc7b8f9 authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FEAT #16956 TIME 3:30 add validators + yousign sources

parent bc329dfd
......@@ -7,7 +7,7 @@
<div *ngIf="!loading" class="userForm">
<mat-form-field appearance="fill" *ngIf="sources.length >= 1">
<mat-label>{{ 'lang.source' | translate }}</mat-label>
<mat-select #source [value]="userOTP.source.id" required>
<mat-select #source [value]="userOTP.sourceId" required>
<mat-option *ngFor="let source of sources" [value]="source.id" >
{{ source.label }}
</mat-option>
......@@ -21,19 +21,15 @@
<mat-label>{{'lang.lastname' | translate}}</mat-label>
<input matInput #lastname type="text" [(ngModel)]="userOTP.lastname" required>
</mat-form-field>
<mat-form-field appearance="fill">
<mat-label>{{'lang.phoneNumber' | translate}}</mat-label>
<input matInput #phoneNumber type="text" [(ngModel)]="userOTP.phone" required>
<input matInput #phoneNumber type="text" [(ngModel)]="userOTP.phone" pattern="^((\+)33)[1-9](\d{2}){4}$" required>
<mat-hint align="start">{{ 'lang.frFormatPhone' | translate }}</mat-hint>
</mat-form-field>
<mat-form-field appearance="fill">
<mat-label>{{'lang.email' | translate}}</mat-label>
<input matInput #email type="email" [(ngModel)]="userOTP.email" required>
<input matInput #email type="email" [(ngModel)]="userOTP.email" pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]{2,4}$" required>
</mat-form-field>
<mat-form-field appearance="fill">
<mat-label>{{'lang.role' | translate}}</mat-label>
<mat-select #role [(ngModel)]="userOTP.role" required>
......@@ -42,17 +38,16 @@
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field appearance="fill">
<mat-label>{{ 'lang.securityMode' | translate }}</mat-label>
<mat-select #securityMode [(ngModel)]="userOTP.mode" required>
<mat-select #securityMode [(ngModel)]="userOTP.security" required>
<mat-option *ngFor="let mode of securityModes" [value]="mode.id" >
{{ mode.label }}
</mat-option>
</mat-select>
</mat-form-field>
<span class="divider-modal"></span>
<app-maarch-message *ngIf="userOTP.mode" [mode]="'info'" [content]="'lang.securityModeInfo' | translate : {mode: userOTP.mode}"></app-maarch-message>
<app-maarch-message *ngIf="userOTP.security" [mode]="'info'" [content]="'lang.securityModeInfo' | translate : {mode: userOTP.security}"></app-maarch-message>
</div>
</div>
<span class="divider-modal"></span>
......
......@@ -55,13 +55,14 @@ export class CreateUserOtpComponent implements OnInit {
];
userOTP: any = {
source: this.sources[0],
firstname: '',
lastname: '',
email: '',
phone: '',
role: '',
mode: ''
security: '',
sourceId: this.sources[0].id,
type: this.sources[0].type
};
constructor(
......@@ -101,8 +102,8 @@ export class CreateUserOtpComponent implements OnInit {
}
validFormat() {
const phoneRegex = /^((\+)33)[1-9](\d{2}){4}$/g;
const emailReegex = /\S+@\S+\.\S+/;
const phoneRegex = /^(\+33)[1-9]{9}$/;
const emailReegex = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]{2,4}$/;
return (this.userOTP.phone.length > 1 && this.userOTP.phone.trim().match(phoneRegex) !== null) && (this.userOTP.email.length > 1 && this.userOTP.email.trim().match(emailReegex) !== null);
}
}
......@@ -355,7 +355,7 @@ export class ExternalVisaWorkflowComponent implements OnInit {
item_id: null,
item_type: 'userOtp',
labelToDisplay: `${data.otp.firstname} ${data.otp.lastname}`,
picture: await this.actionService.getUserOtpIcon(data.otp.source.type),
picture: await this.actionService.getUserOtpIcon(data.otp.type),
hasPrivilege: true,
isValid: true,
role: data.otp.role,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment