commit21
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import { Form, Head } from '@inertiajs/react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import PasswordInput from '@/components/password-input';
|
||||
import InputError from '@/components/input-error';
|
||||
|
||||
export default function ConfirmPassword() {
|
||||
return (
|
||||
<>
|
||||
<Head title="Confirmar palavra-passe" />
|
||||
<h1 className="text-xl font-semibold">Confirmar palavra-passe</h1>
|
||||
<p className="my-4 text-sm">
|
||||
Confirme a palavra-passe da sua conta para continuar esta
|
||||
operação.
|
||||
</p>
|
||||
<Form
|
||||
action="/user/confirm-password"
|
||||
method="post"
|
||||
resetOnError
|
||||
resetOnSuccess
|
||||
>
|
||||
{({ errors, processing }) => (
|
||||
<div className="space-y-4">
|
||||
<label className="grid gap-2">
|
||||
Palavra-passe actual
|
||||
<PasswordInput
|
||||
name="password"
|
||||
autoComplete="current-password"
|
||||
required
|
||||
autoFocus
|
||||
/>
|
||||
</label>
|
||||
<InputError message={errors.password} />
|
||||
<Button disabled={processing}>
|
||||
Confirmar palavra-passe
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</Form>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import { Form, Head } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import InputError from '@/components/input-error';
|
||||
|
||||
export default function TwoFactorChallenge() {
|
||||
const [recovery, setRecovery] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<Head title="Confirmar acesso" />
|
||||
<h1 className="text-xl font-semibold">Confirmar acesso à conta</h1>
|
||||
<p className="my-4 text-sm">
|
||||
{recovery
|
||||
? 'Introduza um dos códigos de recuperação guardados. Cada código só pode ser utilizado uma vez.'
|
||||
: 'Introduza o código da aplicação de autenticação.'}
|
||||
</p>
|
||||
<Form
|
||||
key={String(recovery)}
|
||||
action="/two-factor-challenge"
|
||||
method="post"
|
||||
resetOnError
|
||||
resetOnSuccess
|
||||
>
|
||||
{({ errors, processing }) => (
|
||||
<div className="space-y-4">
|
||||
<label className="grid gap-2">
|
||||
{recovery
|
||||
? 'Código de recuperação'
|
||||
: 'Código de autenticação'}
|
||||
<Input
|
||||
autoFocus
|
||||
name={recovery ? 'recovery_code' : 'code'}
|
||||
autoComplete={
|
||||
recovery ? 'off' : 'one-time-code'
|
||||
}
|
||||
inputMode={recovery ? 'text' : 'numeric'}
|
||||
required
|
||||
/>
|
||||
</label>
|
||||
<InputError
|
||||
message={errors.code ?? errors.recovery_code}
|
||||
/>
|
||||
<Button disabled={processing}>Confirmar acesso</Button>
|
||||
</div>
|
||||
)}
|
||||
</Form>
|
||||
<Button
|
||||
className="mt-4"
|
||||
variant="outline"
|
||||
onClick={() => setRecovery(!recovery)}
|
||||
>
|
||||
{recovery
|
||||
? 'Usar aplicação de autenticação'
|
||||
: 'Usar código de recuperação'}
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user