Warn if forgot password email contains uppercase

This commit is contained in:
Chocobozzz 2024-02-26 15:01:56 +01:00
parent f978e52edc
commit c2c2cd4121
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 20 additions and 5 deletions

View File

@ -1,3 +1,9 @@
<ng-template #uppercaseWarning>
<div i18n class="form-warning">
⚠️ Most email addresses do not include capital letters.
</div>
</ng-template>
<h1 class="title-page-v2">
<strong class="underline-orange">{{ instanceName }}</strong>
@ -54,16 +60,14 @@
<div *ngIf="formErrors.username" class="form-error" role="alert">{{ formErrors.username }}</div>
<div *ngIf="hasUsernameUppercase()" i18n class="form-warning">
⚠️ Most email addresses do not include capital letters.
</div>
<ng-template *ngIf="hasUsernameUppercase()" [ngTemplateOutlet]="uppercaseWarning"></ng-template>
</div>
<div class="form-group">
<label i18n for="password">Password</label>
<my-input-text
formControlName="password" inputId="password" i18n-placeholder placeholder="Password"
formControlName= "password" inputId="password" i18n-placeholder placeholder="Password"
[formError]="formErrors['password']" autocomplete="current-password" [tabindex]="2"
></my-input-text>
</div>
@ -145,6 +149,8 @@
type="email" id="forgot-password-email" i18n-placeholder placeholder="Email address" required
[(ngModel)]="forgotPasswordEmail" #forgotPasswordEmailInput
>
<ng-template *ngIf="hasForgotPasswordEmailUppercase()" [ngTemplateOutlet]="uppercaseWarning"></ng-template>
</div>
</div>

View File

@ -178,7 +178,16 @@ The link will expire within 1 hour.`
}
hasUsernameUppercase () {
return this.form.value['username'].match(/[A-Z]/)
const username = this.form.value['username']
if (!username) return false
return username.match(/[A-Z]/)
}
hasForgotPasswordEmailUppercase () {
if (!this.forgotPasswordEmail) return false
return this.forgotPasswordEmail.match(/[A-Z]/)
}
private loadExternalAuthToken (username: string, token: string) {