Prevent email address validation on blur.

This commit is contained in:
Alec Rippberger 2024-09-23 22:53:58 -05:00
parent 54f0c0a46a
commit c37f726f7d
No known key found for this signature in database
GPG Key ID: 9DD8DA583B28154A
2 changed files with 27 additions and 9 deletions

View File

@ -25,7 +25,13 @@
<!-- Email Address input -->
<bit-form-field class="!tw-mb-4">
<bit-label>{{ "emailAddress" | i18n }}</bit-label>
<input type="email" formControlName="email" bitInput appAutofocus />
<input
type="email"
formControlName="email"
bitInput
appAutofocus
(blur)="onEmailBlur($event)"
/>
</bit-form-field>
<!-- Remember Email input -->

View File

@ -82,14 +82,17 @@ export class LoginComponent implements OnInit, OnDestroy {
showLoginWithDevice = false;
validatedEmail = false;
formGroup = this.formBuilder.group({
formGroup = this.formBuilder.group(
{
email: ["", [Validators.required, Validators.email]],
masterPassword: [
"",
[Validators.required, Validators.minLength(Utils.originalMinimumPasswordLength)],
],
rememberEmail: [false],
});
},
{ updateOn: "submit" },
);
get emailFormControl(): FormControl<string> {
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<void> {
await this.saveEmailSettings();
await this.router.navigateByUrl("/hint");