diff --git a/src/app/auth/otp/otp.component.html b/src/app/auth/otp/otp.component.html
index 315e9a3..1b2d044 100644
--- a/src/app/auth/otp/otp.component.html
+++ b/src/app/auth/otp/otp.component.html
@@ -2,11 +2,11 @@
@if(!isOtpSent()){
-
🔐 Login
+
🔐 Login
}
@if(isOtpSent() && !isVerified()){
-
🔐 OTP Verification
+
🔐 OTP Verification
}
@@ -21,19 +21,9 @@
@if (isOtpSent() && !isVerified()) {
-
- OTP sent to {{ emailForm.value.email }}
-
-
}
+
+ @if (isError()) {
+
+
+ {{ message() }}
+
+ }
+
+ @if (!isError() && isOtpSent() && !isVerified()) {
+
+
+ {{ message() }}
+
+ }
\ No newline at end of file
diff --git a/src/app/auth/otp/otp.component.scss b/src/app/auth/otp/otp.component.scss
index 1678912..2096add 100644
--- a/src/app/auth/otp/otp.component.scss
+++ b/src/app/auth/otp/otp.component.scss
@@ -170,4 +170,24 @@ button {
color: #ccc;
font-size: 14px;
margin-bottom: 10px;
+}
+
+/* Success banner for OTP sent */
+.success-banner {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ background: rgba(120, 255, 140, 0.07);
+ border: 1px solid rgba(120, 255, 140, 0.25);
+ border-radius: 8px;
+ padding: 10px 14px;
+ margin: 10px 0 10px;
+ color: #78ff8c;
+ font-size: 13px;
+
+ i {
+ font-size: 15px;
+ flex-shrink: 0;
+ color: #78ff8c;
+ }
}
\ No newline at end of file
diff --git a/src/app/auth/otp/otp.component.ts b/src/app/auth/otp/otp.component.ts
index d9bf3e2..b97449c 100644
--- a/src/app/auth/otp/otp.component.ts
+++ b/src/app/auth/otp/otp.component.ts
@@ -48,15 +48,27 @@ export class OtpComponent implements OnInit {
if (this.emailForm.invalid) return;
const email = this.emailForm.value.email;
- this.authService.sendOtp(email).subscribe(() => {
- this.isOtpSent.set(true);
- this.message.set('OTP sent successfully!');
- this.startTimer(30); // 30 seconds countdown
+ this.authService.sendOtp(email).subscribe({
+ next: () => {
+ this.isOtpSent.set(true);
+ this.isError.set(false);
+ this.message.set(`OTP sent to ${email}.`);
+ this.startTimer(30); // 30 seconds countdown
+ },
+ error: (err) => {
+ this.isError.set(true);
+ if (err.status === 404) {
+ this.message.set('Email not found. Please check and try again.');
+ } else {
+ this.message.set('Failed to send OTP. Please try again.');
+ }
+ }
});
- }
+}
resendOtp() {
if (this.countdown() > 0) return;
+ this.otpForm.reset();
this.sendOtp();
}