From c37f726f7d1d9fb24c6af97b5ee5b85002fb1a27 Mon Sep 17 00:00:00 2001 From: Alec Rippberger Date: Mon, 23 Sep 2024 22:53:58 -0500 Subject: [PATCH] Prevent email address validation on blur. --- .../src/angular/login/login.component.html | 8 +++++- .../auth/src/angular/login/login.component.ts | 28 +++++++++++++------ 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/libs/auth/src/angular/login/login.component.html b/libs/auth/src/angular/login/login.component.html index 8ff0ba1fad..ca4277aa20 100644 --- a/libs/auth/src/angular/login/login.component.html +++ b/libs/auth/src/angular/login/login.component.html @@ -25,7 +25,13 @@ {{ "emailAddress" | i18n }} - + diff --git a/libs/auth/src/angular/login/login.component.ts b/libs/auth/src/angular/login/login.component.ts index 01ff3a5eea..9f4f98e0cb 100644 --- a/libs/auth/src/angular/login/login.component.ts +++ b/libs/auth/src/angular/login/login.component.ts @@ -82,14 +82,17 @@ export class LoginComponent implements OnInit, OnDestroy { showLoginWithDevice = false; validatedEmail = false; - formGroup = this.formBuilder.group({ - email: ["", [Validators.required, Validators.email]], - masterPassword: [ - "", - [Validators.required, Validators.minLength(Utils.originalMinimumPasswordLength)], - ], - rememberEmail: [false], - }); + formGroup = this.formBuilder.group( + { + email: ["", [Validators.required, Validators.email]], + masterPassword: [ + "", + [Validators.required, Validators.minLength(Utils.originalMinimumPasswordLength)], + ], + rememberEmail: [false], + }, + { updateOn: "submit" }, + ); get emailFormControl(): FormControl { return this.formGroup.controls.email; @@ -373,6 +376,15 @@ export class LoginComponent implements OnInit, OnDestroy { } } + /** + * Set the email value from the input field. + * @param event The event object from the input field. + */ + onEmailBlur(event: Event) { + const emailInput = event.target as HTMLInputElement; + this.formGroup.controls.email.setValue(emailInput.value); + } + protected async goToHint(): Promise { await this.saveEmailSettings(); await this.router.navigateByUrl("/hint");