126 lines
5.4 KiB
TypeScript
126 lines
5.4 KiB
TypeScript
import { participationIdentity } from '@/lib/participation-identity';
|
|
import { useTempoUi } from '@/components/tempo-brand';
|
|
import { Form, Head } from '@inertiajs/react';
|
|
import InputError from '@/components/input-error';
|
|
import PasswordInput from '@/components/password-input';
|
|
import TextLink from '@/components/text-link';
|
|
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 { login } from '@/routes';
|
|
import { store } from '@/routes/register';
|
|
|
|
type Props = {
|
|
passwordRules: string;
|
|
};
|
|
|
|
export default function Register({ passwordRules }: Props) {
|
|
const { t } = useTempoUi();
|
|
return (
|
|
<>
|
|
<Head title={t('Criar conta')} />
|
|
<Form
|
|
{...store.form()}
|
|
resetOnSuccess={['password', 'password_confirmation']}
|
|
disableWhileProcessing
|
|
className="flex flex-col gap-6"
|
|
>
|
|
{({ processing, errors }) => (
|
|
<>
|
|
<div className="grid gap-6">
|
|
<div className="grid gap-2">
|
|
<Label htmlFor="name">{t('Nome')}</Label>
|
|
<Input
|
|
id="name"
|
|
defaultValue={participationIdentity().name}
|
|
type="text"
|
|
required
|
|
tabIndex={1}
|
|
autoComplete="name"
|
|
name="name"
|
|
placeholder={t('Nome completo')}
|
|
/>
|
|
<InputError
|
|
message={errors.name}
|
|
className="mt-2"
|
|
/>
|
|
</div>
|
|
|
|
<div className="grid gap-2">
|
|
<Label htmlFor="email">Email</Label>
|
|
<Input
|
|
id="email"
|
|
defaultValue={participationIdentity().email}
|
|
type="email"
|
|
required
|
|
tabIndex={2}
|
|
autoComplete="email"
|
|
name="email"
|
|
placeholder="email@example.com"
|
|
/>
|
|
<InputError message={errors.email} />
|
|
</div>
|
|
|
|
<div className="grid gap-2">
|
|
<Label htmlFor="password">{t('Palavra-passe')}</Label>
|
|
<PasswordInput
|
|
id="password"
|
|
required
|
|
tabIndex={3}
|
|
autoComplete="new-password"
|
|
name="password"
|
|
placeholder={t('Palavra-passe')}
|
|
passwordrules={passwordRules}
|
|
/>
|
|
<InputError message={errors.password} />
|
|
</div>
|
|
|
|
<div className="grid gap-2">
|
|
<Label htmlFor="password_confirmation">
|
|
{t('Confirmar palavra-passe')}
|
|
</Label>
|
|
<PasswordInput
|
|
id="password_confirmation"
|
|
required
|
|
tabIndex={4}
|
|
autoComplete="new-password"
|
|
name="password_confirmation"
|
|
placeholder={t('Confirmar palavra-passe')}
|
|
passwordrules={passwordRules}
|
|
/>
|
|
<InputError
|
|
message={errors.password_confirmation}
|
|
/>
|
|
</div>
|
|
|
|
<Button
|
|
type="submit"
|
|
className="mt-2 w-full"
|
|
tabIndex={5}
|
|
data-test="register-user-button"
|
|
>
|
|
{processing && <Spinner />}
|
|
{t('Criar conta')}
|
|
</Button>
|
|
</div>
|
|
|
|
<div className="text-muted-foreground text-center text-sm">
|
|
{t('Já tem conta?')}{' '}
|
|
<TextLink href={login()} tabIndex={6}>
|
|
{t('Entrar')}
|
|
</TextLink>
|
|
</div>
|
|
</>
|
|
)}
|
|
</Form>
|
|
</>
|
|
);
|
|
}
|
|
|
|
Register.layout = {
|
|
title: 'Criar conta',
|
|
description:
|
|
'Crie uma conta simples para continuar e acompanhar a sua operação. Não é necessário configurar MFA para participar.',
|
|
};
|