Now I cant login with the changed credentials leon@serfaty.co
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
||||
CardTitle,
|
||||
} from '@/components/ui/card';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { login } from '@/lib/actions/auth';
|
||||
|
||||
const loginSchema = z.object({
|
||||
email: z.string().email({ message: 'Invalid email address.' }),
|
||||
@@ -38,18 +39,16 @@ export default function LoginPage() {
|
||||
|
||||
const onSubmit = async (data: LoginFormValues) => {
|
||||
try {
|
||||
// This is a mock login. In a real app, you'd call an authentication service.
|
||||
console.log('Attempting to log in with:', data.email);
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
const result = await login(data);
|
||||
|
||||
if (data.email === 'admin@example.com' && data.password === 'password') {
|
||||
if (result.success) {
|
||||
toast({
|
||||
title: 'Login Successful',
|
||||
description: 'Redirecting to your dashboard...',
|
||||
});
|
||||
router.push('/admin');
|
||||
} else {
|
||||
throw new Error('Invalid email or password.');
|
||||
throw new Error(result.message);
|
||||
}
|
||||
} catch (error: any) {
|
||||
toast({
|
||||
@@ -105,7 +104,7 @@ export default function LoginPage() {
|
||||
</form>
|
||||
</CardContent>
|
||||
<CardFooter>
|
||||
<p className="text-xs text-center w-full text-muted-foreground">Use admin@example.com and 'password' to sign in.</p>
|
||||
<p className="text-xs text-center w-full text-muted-foreground">Use your updated credentials to sign in.</p>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
</main>
|
||||
|
||||
Reference in New Issue
Block a user