login de cadastro padronizado
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-09 15:05:20 +02:00
parent 67aa015b4c
commit 2209b83820
7 changed files with 463 additions and 175 deletions
+68 -32
View File
@@ -1,6 +1,8 @@
import { participationIdentity } from '@/lib/participation-identity';
import { useTempoUi } from '@/components/tempo-brand';
import { Form, Head } from '@inertiajs/react';
import { UserPlus } from 'lucide-react';
import AuthTempoCard from '@/components/auth-tempo-card';
import InputError from '@/components/input-error';
import PasswordInput from '@/components/password-input';
import TextLink from '@/components/text-link';
@@ -15,22 +17,47 @@ type Props = {
passwordRules: string;
};
const controlClass =
'h-auto rounded-xl border-slate-300 bg-white px-3.5 py-3 text-sm text-slate-900 shadow-sm placeholder:text-slate-400 hover:border-slate-400 focus-visible:border-[#ed1c24] focus-visible:ring-4 focus-visible:ring-[#ed1c24]/10';
const labelClass =
'mb-1.5 block text-xs leading-normal font-bold text-slate-800';
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 }) => (
<AuthTempoCard
badge={t('Bolsa de Parcerias, Investidores e Capital')}
title={t('Criar conta')}
description={t(
'Crie uma conta simples para continuar e acompanhar a sua operação. Não é necessário configurar MFA para participar.',
)}
footer={
<>
<div className="grid gap-6">
<div className="grid gap-2">
<Label htmlFor="name">{t('Nome')}</Label>
{t('Já tem conta?')}{' '}
<TextLink
href={login()}
tabIndex={6}
className="font-bold text-[#ed1c24] no-underline hover:underline"
>
{t('Entrar')}
</TextLink>
</>
}
>
<Form
{...store.form()}
resetOnSuccess={['password', 'password_confirmation']}
disableWhileProcessing
className="flex flex-col gap-5"
>
{({ processing, errors }) => (
<div className="grid gap-5">
<div className="grid gap-1.5">
<Label htmlFor="name" className={labelClass}>
{t('Nome')}
</Label>
<Input
id="name"
defaultValue={participationIdentity().name}
@@ -40,15 +67,15 @@ export default function Register({ passwordRules }: Props) {
autoComplete="name"
name="name"
placeholder={t('Nome completo')}
className={controlClass}
/>
<InputError
message={errors.name}
className="mt-2"
/>
<InputError message={errors.name} />
</div>
<div className="grid gap-2">
<Label htmlFor="email">Email</Label>
<div className="grid gap-1.5">
<Label htmlFor="email" className={labelClass}>
Email
</Label>
<Input
id="email"
defaultValue={participationIdentity().email}
@@ -58,12 +85,18 @@ export default function Register({ passwordRules }: Props) {
autoComplete="email"
name="email"
placeholder="email@example.com"
className={controlClass}
/>
<InputError message={errors.email} />
</div>
<div className="grid gap-2">
<Label htmlFor="password">{t('Palavra-passe')}</Label>
<div className="grid gap-1.5">
<Label
htmlFor="password"
className={labelClass}
>
{t('Palavra-passe')}
</Label>
<PasswordInput
id="password"
required
@@ -72,12 +105,16 @@ export default function Register({ passwordRules }: Props) {
name="password"
placeholder={t('Palavra-passe')}
passwordrules={passwordRules}
className={`${controlClass} pr-10`}
/>
<InputError message={errors.password} />
</div>
<div className="grid gap-2">
<Label htmlFor="password_confirmation">
<div className="grid gap-1.5">
<Label
htmlFor="password_confirmation"
className={labelClass}
>
{t('Confirmar palavra-passe')}
</Label>
<PasswordInput
@@ -88,6 +125,7 @@ export default function Register({ passwordRules }: Props) {
name="password_confirmation"
placeholder={t('Confirmar palavra-passe')}
passwordrules={passwordRules}
className={`${controlClass} pr-10`}
/>
<InputError
message={errors.password_confirmation}
@@ -96,29 +134,27 @@ export default function Register({ passwordRules }: Props) {
<Button
type="submit"
className="mt-2 w-full"
className="mt-1 flex w-full items-center justify-center gap-2 rounded-xl bg-[#ed1c24] px-6 py-4 font-bold text-white shadow-lg shadow-red-900/15 transition hover:-translate-y-0.5 hover:bg-[#c6161d] hover:shadow-xl disabled:translate-y-0 disabled:cursor-not-allowed disabled:opacity-60"
tabIndex={5}
data-test="register-user-button"
>
{processing && <Spinner />}
{processing ? (
<Spinner />
) : (
<UserPlus size={18} />
)}
{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>
)}
</Form>
</AuthTempoCard>
</>
);
}
Register.layout = {
variant: 'tempo-card',
title: 'Criar conta',
description:
'Crie uma conta simples para continuar e acompanhar a sua operação. Não é necessário configurar MFA para participar.',