@@ -1,4 +1,4 @@
|
||||
import { Form, Head } from '@inertiajs/react';
|
||||
import { Form, Head, usePage } from '@inertiajs/react';
|
||||
import InputError from '@/components/input-error';
|
||||
import PasswordInput from '@/components/password-input';
|
||||
import TextLink from '@/components/text-link';
|
||||
@@ -19,13 +19,32 @@ import PasskeyVerify from '@/components/passkey-verify';
|
||||
type Props = {
|
||||
status?: string;
|
||||
canResetPassword: boolean;
|
||||
qaAccount?: { id: number; email: string };
|
||||
};
|
||||
|
||||
export default function Login({ status, canResetPassword }: Props) {
|
||||
export default function Login({ status, canResetPassword, qaAccount }: Props) {
|
||||
// A redirect from another page (e.g. MFA) creates a new Form with empty local errors.
|
||||
const pageErrors = usePage<{ errors: { email?: string } }>().props.errors;
|
||||
return (
|
||||
<>
|
||||
<Head title="Log in" />
|
||||
|
||||
{qaAccount && (
|
||||
<aside
|
||||
className="mb-4 rounded border border-amber-300 bg-amber-50 p-3 text-sm text-slate-900"
|
||||
aria-label="Conta de ensaio QA"
|
||||
>
|
||||
<p className="font-semibold">
|
||||
Ambiente QA — conta {qaAccount.id}
|
||||
</p>
|
||||
<p>
|
||||
Para os cenários A/B: {qaAccount.email}. Use a password e
|
||||
o autenticador desta conta. Outros perfis devem usar as
|
||||
respetivas contas sintéticas QA.
|
||||
</p>
|
||||
</aside>
|
||||
)}
|
||||
|
||||
{/* @chisel-passkeys */}
|
||||
<PasskeyVerify />
|
||||
{/* @end-chisel-passkeys */}
|
||||
@@ -49,8 +68,11 @@ export default function Login({ status, canResetPassword }: Props) {
|
||||
tabIndex={1}
|
||||
autoComplete="email"
|
||||
placeholder="email@example.com"
|
||||
defaultValue={qaAccount?.email}
|
||||
/>
|
||||
<InputError
|
||||
message={errors.email ?? pageErrors.email}
|
||||
/>
|
||||
<InputError message={errors.email} />
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
|
||||
@@ -12,7 +12,11 @@ import {
|
||||
import { OTP_MAX_LENGTH } from '@/hooks/use-two-factor-auth';
|
||||
import { store } from '@/routes/two-factor/login';
|
||||
|
||||
export default function TwoFactorChallenge() {
|
||||
export default function TwoFactorChallenge({
|
||||
qaAccount,
|
||||
}: {
|
||||
qaAccount?: { id: number; email: string };
|
||||
}) {
|
||||
const [showRecoveryInput, setShowRecoveryInput] = useState<boolean>(false);
|
||||
const [code, setCode] = useState<string>('');
|
||||
|
||||
@@ -53,6 +57,16 @@ export default function TwoFactorChallenge() {
|
||||
<>
|
||||
<Head title="Two-factor authentication" />
|
||||
|
||||
{qaAccount && (
|
||||
<p
|
||||
className="mb-4 rounded border border-amber-300 bg-amber-50 p-3 text-sm text-slate-900"
|
||||
role="status"
|
||||
>
|
||||
MFA da conta QA {qaAccount.id}: {qaAccount.email}. Confirme
|
||||
com o autenticador desta conta.
|
||||
</p>
|
||||
)}
|
||||
|
||||
<div className="space-y-6">
|
||||
<Form
|
||||
{...store.form()}
|
||||
|
||||
Reference in New Issue
Block a user