import { useState } from 'react'; import { Navigate } from 'react-router-dom'; import { useAuth } from '@/contexts/AuthContext'; import { ShieldCheck, Mail, Lock, User } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; const Auth = () => { const { user, signIn, signUp, loading } = useAuth(); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [fullName, setFullName] = useState(''); const [authError, setAuthError] = useState(null); // If user is already logged in, redirect to home page if (user) { return ; } const handleSignIn = async (e: React.FormEvent) => { e.preventDefault(); setAuthError(null); try { await signIn(email, password); } catch (error: any) { setAuthError(error.message); } }; const handleSignUp = async (e: React.FormEvent) => { e.preventDefault(); setAuthError(null); try { await signUp(email, password, fullName); } catch (error: any) { setAuthError(error.message); } }; return (

SecuPolicy

Sign in to access your account

Login Register Welcome back Enter your credentials to access your account
setEmail(e.target.value)} required />
setPassword(e.target.value)} required />
{authError && (
{authError}
)}
Create an account Enter your details to create your account
setFullName(e.target.value)} required />
setEmail(e.target.value)} required />
setPassword(e.target.value)} required minLength={6} />
{authError && (
{authError}
)}
); }; export default Auth;