create a comprehensive admin dashbioard with permalink /admin/ and creat
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
|
||||
import { LogIn } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { signIn, getSession } from '@/lib/auth';
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
export default async function LoginPage() {
|
||||
const session = await getSession();
|
||||
if (session) {
|
||||
redirect('/admin');
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen items-center justify-center bg-background">
|
||||
<Card className="w-full max-w-sm">
|
||||
<CardHeader className="text-center">
|
||||
<CardTitle className="text-2xl">Admin Login</CardTitle>
|
||||
<CardDescription>Enter your credentials to access the dashboard.</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<form action={signIn} className="grid gap-4">
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="email">Email</Label>
|
||||
<Input
|
||||
id="email"
|
||||
type="email"
|
||||
name="email"
|
||||
placeholder="admin@example.com"
|
||||
required
|
||||
defaultValue="admin@example.com"
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="password">Password</Label>
|
||||
<Input
|
||||
id="password"
|
||||
type="password"
|
||||
name="password"
|
||||
required
|
||||
defaultValue="password"
|
||||
/>
|
||||
</div>
|
||||
<Button type="submit" className="w-full">
|
||||
<LogIn className="mr-2 h-4 w-4" /> Sign in
|
||||
</Button>
|
||||
</form>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user