Some checks failed
tests / ci (pull_request) Has been cancelled
- Changed user creation to use 'username' instead of 'name'. - Added UserProfile model with relationships to User and gender enum. - Updated validation rules for username and email. - Modified migrations to create user_profiles table and adjust users table. - Updated seeder to create users with profiles. - Translated various UI texts to Indonesian and improved layout components.
97 lines
3.7 KiB
TypeScript
97 lines
3.7 KiB
TypeScript
import { Form, Head } from '@inertiajs/react';
|
|
import InputError from '@/components/input-error';
|
|
import PasswordInput from '@/components/password-input';
|
|
import { Button } from '@/components/ui/button';
|
|
import { Input } from '@/components/ui/input';
|
|
import { Label } from '@/components/ui/label';
|
|
import { Spinner } from '@/components/ui/spinner';
|
|
import { update } from '@/routes/password';
|
|
|
|
type Props = {
|
|
token: string;
|
|
email: string;
|
|
passwordRules: string;
|
|
};
|
|
|
|
export default function ResetPassword({ token, email, passwordRules }: Props) {
|
|
return (
|
|
<>
|
|
<Head title="Reset password" />
|
|
|
|
<Form
|
|
{...update.form()}
|
|
transform={(data) => ({ ...data, token, email })}
|
|
resetOnSuccess={['password', 'password_confirmation']}
|
|
>
|
|
{({ processing, errors }) => (
|
|
<div className="grid gap-6">
|
|
<div className="grid gap-2">
|
|
<Label htmlFor="email">Email</Label>
|
|
<Input
|
|
id="email"
|
|
type="email"
|
|
name="email"
|
|
autoComplete="email"
|
|
value={email}
|
|
className="mt-1 block w-full"
|
|
readOnly
|
|
/>
|
|
<InputError
|
|
message={errors.email}
|
|
className="mt-2"
|
|
/>
|
|
</div>
|
|
|
|
<div className="grid gap-2">
|
|
<Label htmlFor="password">Password baru</Label>
|
|
<PasswordInput
|
|
id="password"
|
|
name="password"
|
|
autoComplete="new-password"
|
|
className="mt-1 block w-full"
|
|
autoFocus
|
|
placeholder="Password baru"
|
|
passwordrules={passwordRules}
|
|
/>
|
|
<InputError message={errors.password} />
|
|
</div>
|
|
|
|
<div className="grid gap-2">
|
|
<Label htmlFor="password_confirmation">
|
|
Konfirmasi password
|
|
</Label>
|
|
<PasswordInput
|
|
id="password_confirmation"
|
|
name="password_confirmation"
|
|
autoComplete="new-password"
|
|
className="mt-1 block w-full"
|
|
placeholder="Konfirmasi password"
|
|
passwordrules={passwordRules}
|
|
/>
|
|
<InputError
|
|
message={errors.password_confirmation}
|
|
className="mt-2"
|
|
/>
|
|
</div>
|
|
|
|
<Button
|
|
type="submit"
|
|
className="mt-4 w-full"
|
|
disabled={processing}
|
|
data-test="reset-password-button"
|
|
>
|
|
{processing && <Spinner />}
|
|
Reset password
|
|
</Button>
|
|
</div>
|
|
)}
|
|
</Form>
|
|
</>
|
|
);
|
|
}
|
|
|
|
ResetPassword.layout = {
|
|
title: 'Reset password',
|
|
description: 'Masukkan password baru Anda di bawah ini',
|
|
};
|