All files / laravel-saas/resources/js/Pages/Auth ConfirmPassword.tsx

0% Statements 0/48
0% Branches 0/1
0% Functions 0/1
0% Lines 0/48

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                                                                                                                   
import { FormEventHandler, useEffect } from 'react';
import { Head, 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';
 
export default function ConfirmPassword() {
    const { data, setData, post, processing, errors, reset } = useForm({
        password: '',
    });
 
    useEffect(() => {
        return () => {
            reset('password');
        };
    }, []);
 
    const submit: FormEventHandler = (e) => {
        e.preventDefault();
        post(route('password.confirm'));
    };
 
    return (
        <GuestLayout header="Confirm Password" subheader="This is a secure area of the application. Please confirm your password before continuing.">
            <Head title="Confirm Password" />
 
            <form onSubmit={submit} className="space-y-4">
                <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)}
                        placeholder="Enter your password"
                        autoFocus
                    />
                    {errors.password && (
                        <p className="mt-1 text-sm text-destructive">
                            {errors.password}
                        </p>
                    )}
                </div>
 
                <Button type="submit" loading={processing} className="w-full">
                    Confirm
                </Button>
            </form>
        </GuestLayout>
    );
}