1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 16:23:44 +00:00

PM-8866 - Fix Recover delete component submit missing form validation. (#9658)

This commit is contained in:
Jared Snider
2024-06-14 13:49:27 -04:00
committed by GitHub
parent 44b5971458
commit a95ca524c6

View File

@@ -13,9 +13,13 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
}) })
export class RecoverDeleteComponent { export class RecoverDeleteComponent {
protected recoverDeleteForm = new FormGroup({ protected recoverDeleteForm = new FormGroup({
email: new FormControl(null, [Validators.required]), email: new FormControl("", [Validators.required]),
}); });
get email() {
return this.recoverDeleteForm.controls.email;
}
constructor( constructor(
private router: Router, private router: Router,
private apiService: ApiService, private apiService: ApiService,
@@ -24,8 +28,12 @@ export class RecoverDeleteComponent {
) {} ) {}
submit = async () => { submit = async () => {
if (this.recoverDeleteForm.invalid) {
return;
}
const request = new DeleteRecoverRequest(); const request = new DeleteRecoverRequest();
request.email = this.recoverDeleteForm.value.email.trim().toLowerCase(); request.email = this.email.value.trim().toLowerCase();
await this.apiService.postAccountRecoverDelete(request); await this.apiService.postAccountRecoverDelete(request);
this.platformUtilsService.showToast( this.platformUtilsService.showToast(
"success", "success",