MOBILE-2567 login: Escape mail to avoid regexp compare

main
Pau Ferrer Ocaña 2018-08-28 15:30:21 +02:00
parent b72cea5823
commit 558c22c3b3
2 changed files with 11 additions and 1 deletions

View File

@ -87,7 +87,7 @@
</ion-item> </ion-item>
<ion-item text-wrap> <ion-item text-wrap>
<ion-label stacked core-mark-required="true">{{ 'core.user.emailagain' | translate }}</ion-label> <ion-label stacked core-mark-required="true">{{ 'core.user.emailagain' | translate }}</ion-label>
<ion-input type="email" name="email2" placeholder="{{ 'core.user.emailagain' | translate }}" formControlName="email2" autocapitalize="none" autocorrect="off" pattern="{{signupForm.controls.email.value}}"></ion-input> <ion-input type="email" name="email2" placeholder="{{ 'core.user.emailagain' | translate }}" formControlName="email2" autocapitalize="none" autocorrect="off" [pattern]="escapeMail(signupForm.controls.email.value)"></ion-input>
<core-input-errors item-content [control]="signupForm.controls.email2" [errorMessages]="email2Errors"></core-input-errors> <core-input-errors item-content [control]="signupForm.controls.email2" [errorMessages]="email2Errors"></core-input-errors>
</ion-item> </ion-item>
<ion-item *ngFor="let nameField of settings.namefields" text-wrap> <ion-item *ngFor="let nameField of settings.namefields" text-wrap>

View File

@ -283,6 +283,16 @@ export class CoreLoginEmailSignupPage {
} }
} }
/**
* Escape mail to avoid special characters to be treated as a RegExp.
*
* @param {string} text Initial mail.
* @return {string} Escaped mail.
*/
escapeMail(text: string): string {
return this.textUtils.escapeForRegex(text);
}
/** /**
* Show authentication instructions. * Show authentication instructions.
*/ */