From 746a8dbea09eeffe0fc69b4992ef27abf4954e4d Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Mon, 10 Mar 2025 08:37:22 +0000 Subject: [PATCH] Rebuild authentication page Rebuild the authentication page. --- src/pages/Auth.tsx | 58 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/src/pages/Auth.tsx b/src/pages/Auth.tsx index a06961a..9831d28 100644 --- a/src/pages/Auth.tsx +++ b/src/pages/Auth.tsx @@ -2,7 +2,7 @@ import { useState } from 'react'; import { Navigate } from 'react-router-dom'; import { useAuth } from '@/contexts/AuthContext'; -import { ShieldCheck, Mail, Lock, User } from 'lucide-react'; +import { ShieldCheck, Mail, Lock, User, Loader2 } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; @@ -15,8 +15,9 @@ const Auth = () => { const [password, setPassword] = useState(''); const [fullName, setFullName] = useState(''); const [authError, setAuthError] = useState(null); + const [activeTab, setActiveTab] = useState('login'); - // If user is already logged in, redirect to home page + // If user is already logged in, redirect to dashboard if (user) { return ; } @@ -27,7 +28,8 @@ const Auth = () => { try { await signIn(email, password); } catch (error: any) { - setAuthError(error.message); + console.error('Sign in error:', error); + // Error is already handled by the toast in AuthContext } }; @@ -36,30 +38,38 @@ const Auth = () => { setAuthError(null); try { await signUp(email, password, fullName); + // Switch to login tab after successful signup + setActiveTab('login'); } catch (error: any) { - setAuthError(error.message); + console.error('Sign up error:', error); + // Error is already handled by the toast in AuthContext } }; return ( -
-
+
+
-
+

SecuPolicy

-

Sign in to access your account

+

Secure access to your account

- + - Login - Register + Sign In + Create Account - + Welcome back @@ -104,10 +114,17 @@ const Auth = () => { @@ -115,7 +132,7 @@ const Auth = () => { - + Create an account @@ -176,10 +193,17 @@ const Auth = () => {