From 2ff46c045ccaf670e115ea9377e2460165de33a1 Mon Sep 17 00:00:00 2001 From: John Harrington <84741727+harr1424@users.noreply.github.com> Date: Tue, 17 Feb 2026 16:26:24 -0700 Subject: [PATCH] respond to review comments --- .../send-access-email.component.html | 8 +--- .../send-access-email.component.ts | 48 +++++++++++-------- .../send/send-access/send-auth.component.ts | 8 ---- 3 files changed, 29 insertions(+), 35 deletions(-) diff --git a/apps/web/src/app/tools/send/send-access/send-access-email.component.html b/apps/web/src/app/tools/send/send-access/send-access-email.component.html index 00a63318072..56155fb19ad 100644 --- a/apps/web/src/app/tools/send/send-access/send-access-email.component.html +++ b/apps/web/src/app/tools/send/send-access/send-access-email.component.html @@ -34,13 +34,7 @@ > {{ "viewSend" | i18n }} - } diff --git a/apps/web/src/app/tools/send/send-access/send-access-email.component.ts b/apps/web/src/app/tools/send/send-access/send-access-email.component.ts index d811618532b..0915a47e4ad 100644 --- a/apps/web/src/app/tools/send/send-access/send-access-email.component.ts +++ b/apps/web/src/app/tools/send/send-access/send-access-email.component.ts @@ -28,35 +28,43 @@ export class SendAccessEmailComponent implements OnInit, OnDestroy { readonly loading = input.required(); readonly backToEmail = output(); - constructor() { - // Update validators when enterOtp changes - effect(() => { - const isOtpMode = this.enterOtp(); - if (this.email && this.otp) { - if (isOtpMode) { - // In OTP mode: email is not required (already entered), otp is required - this.email.clearValidators(); - this.otp.setValidators([Validators.required]); - } else { - // In email mode: email is required, otp is not required - this.email.setValidators([Validators.required]); - this.otp.clearValidators(); - } - this.email.updateValueAndValidity(); - this.otp.updateValueAndValidity(); - } - }); - } + constructor() {} ngOnInit() { this.email = new FormControl("", Validators.required); this.otp = new FormControl(""); this.formGroup().addControl("email", this.email); this.formGroup().addControl("otp", this.otp); - } + // Update validators when enterOtp changes + effect(() => { + const isOtpMode = this.enterOtp(); + if (isOtpMode) { + // In OTP mode: email is not required (already entered), otp is required + this.email.clearValidators(); + this.otp.setValidators([Validators.required]); + } else { + // In email mode: email is required, otp is not required + this.email.setValidators([Validators.required]); + this.otp.clearValidators(); + } + this.email.updateValueAndValidity(); + this.otp.updateValueAndValidity(); + }); + } ngOnDestroy() { this.formGroup().removeControl("email"); this.formGroup().removeControl("otp"); } + + onBackClick() { + this.backToEmail.emit(); + if (this.otp) { + this.otp.clearValidators(); + this.otp.setValue(""); + this.otp.setErrors(null); + this.otp.markAsUntouched(); + this.otp.markAsPristine(); + } + } } diff --git a/apps/web/src/app/tools/send/send-access/send-auth.component.ts b/apps/web/src/app/tools/send/send-access/send-auth.component.ts index dc4fc06dae2..dc6543d23ef 100644 --- a/apps/web/src/app/tools/send/send-access/send-auth.component.ts +++ b/apps/web/src/app/tools/send/send-access/send-auth.component.ts @@ -92,14 +92,6 @@ export class SendAuthComponent implements OnInit { onBackToEmail() { this.enterOtp.set(false); - const otpControl = this.sendAccessForm.controls.otp; - if (otpControl) { - otpControl.clearValidators(); - otpControl.setValue(""); - otpControl.setErrors(null); - otpControl.markAsUntouched(); - otpControl.markAsPristine(); - } this.updatePageTitle(); }