diff --git a/app/(auth)/login/page.tsx b/app/(auth)/login/page.tsx index 1ba846d..f7ceaa8 100644 --- a/app/(auth)/login/page.tsx +++ b/app/(auth)/login/page.tsx @@ -273,12 +273,13 @@ export default function Login() { try { const result = await verifyOtp(otpToVerify); - // If verification is successful, redirect to login page - toast.success("Email verified successfully! Redirecting to login..."); - // Redirect to login page with email pre-filled - setTimeout(() => { - router.push(`/login?email=${encodeURIComponent(emailToVerify)}`); - }, 1000); + // If verification is successful, switch to login step + toast.success("Email verified successfully! You can now login."); + // Switch to login step and pre-fill email + setStep("login"); + setLoginData(prev => ({ ...prev, email: emailToVerify })); + setOtpData({ email: "", otp: "" }); + setRegisteredEmail(""); } catch (error) { const errorMessage = error instanceof Error ? error.message : "OTP verification failed. Please try again."; toast.error(errorMessage); diff --git a/components/LoginDialog.tsx b/components/LoginDialog.tsx index fb6f883..aa5d678 100644 --- a/components/LoginDialog.tsx +++ b/components/LoginDialog.tsx @@ -134,15 +134,15 @@ export function LoginDialog({ open, onOpenChange, onLoginSuccess }: LoginDialogP - {/* Header with Close Button */} -
- - + {/* Header with Close Button - Fixed */} +
+ + {isSignup ? "Create an account" : "Welcome back"} - + {isSignup ? "Sign up to complete your booking" : "Please log in to complete your booking"} @@ -158,9 +158,11 @@ export function LoginDialog({ open, onOpenChange, onLoginSuccess }: LoginDialogP
- {/* Signup Form */} - {isSignup ? ( -
+ {/* Scrollable Content */} +
+ {/* Signup Form */} + {isSignup ? ( + {error && (

{error}

@@ -168,7 +170,7 @@ export function LoginDialog({ open, onOpenChange, onLoginSuccess }: LoginDialogP )} {/* First Name Field */} -
+
@@ -178,13 +180,13 @@ export function LoginDialog({ open, onOpenChange, onLoginSuccess }: LoginDialogP placeholder="John" value={signupData.first_name} onChange={(e) => setSignupData({ ...signupData, first_name: e.target.value })} - className={`h-12 ${isDark ? 'bg-gray-700 border-gray-600 text-white placeholder:text-gray-400' : 'bg-white border-gray-300 text-gray-900'}`} + className={`h-11 sm:h-12 text-sm sm:text-base ${isDark ? 'bg-gray-700 border-gray-600 text-white placeholder:text-gray-400' : 'bg-white border-gray-300 text-gray-900'}`} required />
{/* Last Name Field */} -
+
@@ -194,13 +196,13 @@ export function LoginDialog({ open, onOpenChange, onLoginSuccess }: LoginDialogP placeholder="Doe" value={signupData.last_name} onChange={(e) => setSignupData({ ...signupData, last_name: e.target.value })} - className={`h-12 ${isDark ? 'bg-gray-700 border-gray-600 text-white placeholder:text-gray-400' : 'bg-white border-gray-300 text-gray-900'}`} + className={`h-11 sm:h-12 text-sm sm:text-base ${isDark ? 'bg-gray-700 border-gray-600 text-white placeholder:text-gray-400' : 'bg-white border-gray-300 text-gray-900'}`} required />
{/* Email Field */} -
+
@@ -210,13 +212,13 @@ export function LoginDialog({ open, onOpenChange, onLoginSuccess }: LoginDialogP placeholder="Email address" value={signupData.email} onChange={(e) => setSignupData({ ...signupData, email: e.target.value })} - className={`h-12 ${isDark ? 'bg-gray-700 border-gray-600 text-white placeholder:text-gray-400' : 'bg-white border-gray-300 text-gray-900'}`} + className={`h-11 sm:h-12 text-sm sm:text-base ${isDark ? 'bg-gray-700 border-gray-600 text-white placeholder:text-gray-400' : 'bg-white border-gray-300 text-gray-900'}`} required />
{/* Phone Field */} -
+
@@ -226,12 +228,12 @@ export function LoginDialog({ open, onOpenChange, onLoginSuccess }: LoginDialogP placeholder="+1 (555) 123-4567" value={signupData.phone_number || ""} onChange={(e) => setSignupData({ ...signupData, phone_number: e.target.value })} - className={`h-12 ${isDark ? 'bg-gray-700 border-gray-600 text-white placeholder:text-gray-400' : 'bg-white border-gray-300 text-gray-900'}`} + className={`h-11 sm:h-12 text-sm sm:text-base ${isDark ? 'bg-gray-700 border-gray-600 text-white placeholder:text-gray-400' : 'bg-white border-gray-300 text-gray-900'}`} />
{/* Password Field */} -
+
@@ -242,7 +244,7 @@ export function LoginDialog({ open, onOpenChange, onLoginSuccess }: LoginDialogP placeholder="Password (min 8 characters)" value={signupData.password} onChange={(e) => setSignupData({ ...signupData, password: e.target.value })} - className={`h-12 pr-12 ${isDark ? 'bg-gray-700 border-gray-600 text-white placeholder:text-gray-400' : 'bg-white border-gray-300 text-gray-900'}`} + className={`h-11 sm:h-12 pr-12 text-sm sm:text-base ${isDark ? 'bg-gray-700 border-gray-600 text-white placeholder:text-gray-400' : 'bg-white border-gray-300 text-gray-900'}`} required />
{/* Confirm Password Field */} -
+
@@ -274,7 +276,7 @@ export function LoginDialog({ open, onOpenChange, onLoginSuccess }: LoginDialogP placeholder="Confirm password" value={signupData.password2} onChange={(e) => setSignupData({ ...signupData, password2: e.target.value })} - className={`h-12 pr-12 ${isDark ? 'bg-gray-700 border-gray-600 text-white placeholder:text-gray-400' : 'bg-white border-gray-300 text-gray-900'}`} + className={`h-11 sm:h-12 pr-12 text-sm sm:text-base ${isDark ? 'bg-gray-700 border-gray-600 text-white placeholder:text-gray-400' : 'bg-white border-gray-300 text-gray-900'}`} required />
@@ -298,7 +300,7 @@ export function LoginDialog({ open, onOpenChange, onLoginSuccess }: LoginDialogP {/* Switch to Login */} -

+

Already have an account?{" "}

@@ -383,7 +385,7 @@ export function LoginDialog({ open, onOpenChange, onLoginSuccess }: LoginDialogP {/* Remember Me & Forgot Password */} -
+
{/* Sign Up Prompt */} -

+

New to Attune Heart Therapy?{" "}

);