Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | 1x 1x 1x 1x 1x 1x 1x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 2x 2x 2x 16x 16x 16x 16x 1x 1x 1x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 3x 3x 3x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 2x 2x 2x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 15x 15x 15x 15x 15x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x | import { FormEventHandler, useEffect } from 'react';
import { Head, Link, useForm } from '@inertiajs/react';
import GuestLayout from '@/Components/GuestLayout';
import { Button } from '@/Components/ui/Button';
import { Input } from '@/Components/ui/Input';
import { Label } from '@/Components/ui/Label';
import SocialLoginGroup from '@/Components/SocialLoginGroup';
export default function Login({
status,
canResetPassword,
}: {
status?: string;
canResetPassword: boolean;
}) {
const { data, setData, post, processing, errors, reset } = useForm({
email: '',
password: '',
remember: false,
});
useEffect(() => {
return () => {
reset('password');
};
}, []);
const submit: FormEventHandler = (e) => {
e.preventDefault();
post(route('login'));
};
return (
<GuestLayout header="Welcome back" subheader="Sign in to your account">
<Head title="Log in" />
{status && (
<div className="mb-4 text-sm font-medium text-green-400">
{status}
</div>
)}
<form onSubmit={submit} className="space-y-4">
<div>
<Label htmlFor="email" className="">
Email
</Label>
<Input
id="email"
type="email"
name="email"
value={data.email}
className="mt-1"
autoComplete="username"
error={!!errors.email}
onChange={(e) => setData('email', e.target.value)}
/>
{errors.email && (
<p className="mt-1 text-sm text-destructive">
{errors.email}
</p>
)}
</div>
<div>
<Label htmlFor="password" className="">
Password
</Label>
<Input
id="password"
type="password"
name="password"
value={data.password}
className="mt-1"
autoComplete="current-password"
error={!!errors.password}
onChange={(e) => setData('password', e.target.value)}
/>
{errors.password && (
<p className="mt-1 text-sm text-destructive">
{errors.password}
</p>
)}
</div>
<div className="flex items-center justify-between">
<div className="flex items-center">
<input
id="remember"
name="remember"
type="checkbox"
className="h-4 w-4"
checked={data.remember}
onChange={(e) => setData('remember', e.target.checked as any)}
/>
<Label htmlFor="remember" className="ml-2 text-sm text-muted-foreground">
Remember me
</Label>
</div>
{canResetPassword && (
<Link
href={route('password.request')}
className="text-sm text-muted-foreground hover:text-foreground"
>
Forgot password?
</Link>
)}
</div>
<Button type="submit" loading={processing} className="w-full">
Sign in
</Button>
<SocialLoginGroup />
<div className="text-center pt-4">
<p className="text-sm text-muted-foreground">
Don't have an account?{' '}
<Link
href={route('register')}
className="text-foreground hover:text-zinc-300 font-medium"
>
Sign up
</Link>
</p>
</div>
</form>
</GuestLayout>
);
} |