Juntar mfa-qr-pt ao main
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,9 +12,9 @@ export default function AppearanceToggleTab({
|
||||
const { appearance, updateAppearance } = useAppearance();
|
||||
|
||||
const tabs: { value: Appearance; icon: LucideIcon; label: string }[] = [
|
||||
{ value: 'light', icon: Sun, label: 'Light' },
|
||||
{ value: 'dark', icon: Moon, label: 'Dark' },
|
||||
{ value: 'system', icon: Monitor, label: 'System' },
|
||||
{ value: 'light', icon: Sun, label: 'Claro' },
|
||||
{ value: 'dark', icon: Moon, label: 'Escuro' },
|
||||
{ value: 'system', icon: Monitor, label: 'Sistema' },
|
||||
];
|
||||
|
||||
return (
|
||||
|
||||
@@ -23,14 +23,14 @@ export default function DeleteUser() {
|
||||
<div className="space-y-6">
|
||||
<Heading
|
||||
variant="small"
|
||||
title="Delete account"
|
||||
description="Delete your account and all of its resources"
|
||||
title="Apagar conta"
|
||||
description="Apagar a sua conta e todos os dados associados"
|
||||
/>
|
||||
<div className="space-y-4 rounded-lg border border-red-100 bg-red-50 p-4 dark:border-red-200/10 dark:bg-red-700/10">
|
||||
<div className="relative space-y-0.5 text-red-600 dark:text-red-100">
|
||||
<p className="font-medium">Warning</p>
|
||||
<p className="font-medium">Atenção</p>
|
||||
<p className="text-sm">
|
||||
Please proceed with caution, this cannot be undone.
|
||||
Proceda com cuidado: esta acção não pode ser desfeita.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -40,18 +40,17 @@ export default function DeleteUser() {
|
||||
variant="destructive"
|
||||
data-test="delete-user-button"
|
||||
>
|
||||
Delete account
|
||||
Apagar conta
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
<DialogContent>
|
||||
<DialogTitle>
|
||||
Are you sure you want to delete your account?
|
||||
Tem a certeza de que quer apagar a sua conta?
|
||||
</DialogTitle>
|
||||
<DialogDescription>
|
||||
Once your account is deleted, all of its resources
|
||||
and data will also be permanently deleted. Please
|
||||
enter your password to confirm you would like to
|
||||
permanently delete your account.
|
||||
Depois de apagada, a conta e todos os seus dados são
|
||||
eliminados de forma permanente. Introduza a
|
||||
palavra-passe para confirmar.
|
||||
</DialogDescription>
|
||||
|
||||
<Form
|
||||
@@ -70,14 +69,14 @@ export default function DeleteUser() {
|
||||
htmlFor="password"
|
||||
className="sr-only"
|
||||
>
|
||||
Password
|
||||
Palavra-passe
|
||||
</Label>
|
||||
|
||||
<PasswordInput
|
||||
id="password"
|
||||
name="password"
|
||||
ref={passwordInput}
|
||||
placeholder="Password"
|
||||
placeholder="Palavra-passe"
|
||||
autoComplete="current-password"
|
||||
/>
|
||||
|
||||
@@ -92,7 +91,7 @@ export default function DeleteUser() {
|
||||
resetAndClearErrors()
|
||||
}
|
||||
>
|
||||
Cancel
|
||||
Cancelar
|
||||
</Button>
|
||||
</DialogClose>
|
||||
|
||||
@@ -105,7 +104,7 @@ export default function DeleteUser() {
|
||||
type="submit"
|
||||
data-test="confirm-delete-user-button"
|
||||
>
|
||||
Delete account
|
||||
Apagar conta
|
||||
</button>
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
|
||||
@@ -23,7 +23,11 @@ export default function PasswordInput({
|
||||
type="button"
|
||||
onClick={() => setShowPassword((prev) => !prev)}
|
||||
className="absolute inset-y-0 right-0 flex items-center rounded-r-md px-3 text-muted-foreground hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring focus-visible:outline-none"
|
||||
aria-label={showPassword ? 'Hide password' : 'Show password'}
|
||||
aria-label={
|
||||
showPassword
|
||||
? 'Ocultar palavra-passe'
|
||||
: 'Mostrar palavra-passe'
|
||||
}
|
||||
tabIndex={-1}
|
||||
>
|
||||
{showPassword ? (
|
||||
|
||||
@@ -13,6 +13,7 @@ export default function TwoFactorManagement({
|
||||
const [enabled, setEnabled] = useState(initialEnabled);
|
||||
const [pending, setPending] = useState(initialPending);
|
||||
const [secret, setSecret] = useState('');
|
||||
const [qrSvg, setQrSvg] = useState('');
|
||||
const [code, setCode] = useState('');
|
||||
const [codes, setCodes] = useState<string[]>([]);
|
||||
const [busy, setBusy] = useState(false);
|
||||
@@ -76,8 +77,12 @@ export default function TwoFactorManagement({
|
||||
}
|
||||
}
|
||||
const loadSecret = async () => {
|
||||
const data = await request('/user/two-factor-secret-key');
|
||||
setSecret(data.secretKey);
|
||||
const [key, qr] = await Promise.all([
|
||||
request('/user/two-factor-secret-key'),
|
||||
request('/user/two-factor-qr-code'),
|
||||
]);
|
||||
setSecret(key.secretKey);
|
||||
setQrSvg(typeof qr?.svg === 'string' ? qr.svg : '');
|
||||
};
|
||||
const loadCodes = async () => {
|
||||
setCodes(await request('/user/two-factor-recovery-codes'));
|
||||
@@ -130,8 +135,22 @@ export default function TwoFactorManagement({
|
||||
{pending && secret && (
|
||||
<>
|
||||
<p className="text-sm">
|
||||
Na aplicação autenticadora, adicione uma conta com esta
|
||||
chave manual. Não partilhe esta chave.
|
||||
Na aplicação autenticadora (por exemplo Google
|
||||
Authenticator ou Microsoft Authenticator), leia este
|
||||
código QR. Não partilhe o código nem a chave.
|
||||
</p>
|
||||
{qrSvg && (
|
||||
<div
|
||||
role="img"
|
||||
aria-label="Código QR para a aplicação autenticadora"
|
||||
className="inline-block rounded-lg border bg-white p-3 [&_svg]:size-48"
|
||||
// SVG gerado pelo servidor (Fortify) a partir do segredo da própria conta.
|
||||
dangerouslySetInnerHTML={{ __html: qrSvg }}
|
||||
/>
|
||||
)}
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Se não conseguir ler o código QR, introduza esta chave
|
||||
manualmente:
|
||||
</p>
|
||||
<code className="block rounded bg-muted p-3 break-all">
|
||||
{secret}
|
||||
@@ -149,6 +168,7 @@ export default function TwoFactorManagement({
|
||||
setEnabled(true);
|
||||
setPending(false);
|
||||
setSecret('');
|
||||
setQrSvg('');
|
||||
setCode('');
|
||||
await loadCodes();
|
||||
});
|
||||
@@ -240,6 +260,7 @@ export default function TwoFactorManagement({
|
||||
setEnabled(false);
|
||||
setPending(false);
|
||||
setSecret('');
|
||||
setQrSvg('');
|
||||
setCode('');
|
||||
setCodes([]);
|
||||
} else {
|
||||
|
||||
@@ -12,17 +12,17 @@ import type { NavItem } from '@/types';
|
||||
|
||||
const sidebarNavItems: NavItem[] = [
|
||||
{
|
||||
title: 'Profile',
|
||||
title: 'Perfil',
|
||||
href: edit(),
|
||||
icon: null,
|
||||
},
|
||||
{
|
||||
title: 'Security',
|
||||
title: 'Segurança',
|
||||
href: editSecurity(),
|
||||
icon: null,
|
||||
},
|
||||
{
|
||||
title: 'Appearance',
|
||||
title: 'Aparência',
|
||||
href: editAppearance(),
|
||||
icon: null,
|
||||
},
|
||||
@@ -34,15 +34,15 @@ export default function SettingsLayout({ children }: PropsWithChildren) {
|
||||
return (
|
||||
<div className="px-4 py-6">
|
||||
<Heading
|
||||
title="Settings"
|
||||
description="Manage your profile and account settings"
|
||||
title="Definições"
|
||||
description="Gerir o perfil e a segurança da sua conta"
|
||||
/>
|
||||
|
||||
<div className="flex flex-col lg:flex-row lg:space-x-12">
|
||||
<aside className="w-full max-w-xl lg:w-48">
|
||||
<nav
|
||||
className="flex flex-col space-y-1 space-x-0"
|
||||
aria-label="Settings"
|
||||
aria-label="Definições"
|
||||
>
|
||||
{sidebarNavItems.map((item, index) => (
|
||||
<Button
|
||||
|
||||
@@ -6,15 +6,15 @@ import { edit as editAppearance } from '@/routes/appearance';
|
||||
export default function Appearance() {
|
||||
return (
|
||||
<>
|
||||
<Head title="Appearance settings" />
|
||||
<Head title="Aparência" />
|
||||
|
||||
<h1 className="sr-only">Appearance settings</h1>
|
||||
<h1 className="sr-only">Aparência</h1>
|
||||
|
||||
<div className="space-y-6">
|
||||
<Heading
|
||||
variant="small"
|
||||
title="Appearance settings"
|
||||
description="Update the appearance settings for your account"
|
||||
title="Aparência"
|
||||
description="Escolha o tema da aplicação neste dispositivo"
|
||||
/>
|
||||
<AppearanceTabs />
|
||||
</div>
|
||||
@@ -25,7 +25,7 @@ export default function Appearance() {
|
||||
Appearance.layout = {
|
||||
breadcrumbs: [
|
||||
{
|
||||
title: 'Appearance settings',
|
||||
title: 'Aparência',
|
||||
href: editAppearance(),
|
||||
},
|
||||
],
|
||||
|
||||
@@ -18,15 +18,15 @@ export default function Profile() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head title="Profile settings" />
|
||||
<Head title="Perfil" />
|
||||
|
||||
<h1 className="sr-only">Profile settings</h1>
|
||||
<h1 className="sr-only">Perfil</h1>
|
||||
|
||||
<div className="space-y-6">
|
||||
<Heading
|
||||
variant="small"
|
||||
title="Profile"
|
||||
description="Update your name and email address"
|
||||
title="Perfil"
|
||||
description="Actualize o seu nome e endereço de email"
|
||||
/>
|
||||
|
||||
<Form
|
||||
@@ -39,7 +39,7 @@ export default function Profile() {
|
||||
{({ processing, errors }) => (
|
||||
<>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="name">Name</Label>
|
||||
<Label htmlFor="name">Nome</Label>
|
||||
|
||||
<Input
|
||||
id="name"
|
||||
@@ -48,7 +48,7 @@ export default function Profile() {
|
||||
name="name"
|
||||
required
|
||||
autoComplete="name"
|
||||
placeholder="Full name"
|
||||
placeholder="Nome completo"
|
||||
/>
|
||||
|
||||
<InputError
|
||||
@@ -58,7 +58,7 @@ export default function Profile() {
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="email">Email address</Label>
|
||||
<Label htmlFor="email">Endereço de email</Label>
|
||||
|
||||
<Input
|
||||
id="email"
|
||||
@@ -68,7 +68,7 @@ export default function Profile() {
|
||||
name="email"
|
||||
required
|
||||
autoComplete="username"
|
||||
placeholder="Email address"
|
||||
placeholder="Endereço de email"
|
||||
/>
|
||||
|
||||
<InputError
|
||||
@@ -82,7 +82,7 @@ export default function Profile() {
|
||||
disabled={processing}
|
||||
data-test="update-profile-button"
|
||||
>
|
||||
Save
|
||||
Guardar
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
@@ -98,7 +98,7 @@ export default function Profile() {
|
||||
Profile.layout = {
|
||||
breadcrumbs: [
|
||||
{
|
||||
title: 'Profile settings',
|
||||
title: 'Perfil',
|
||||
href: edit(),
|
||||
},
|
||||
],
|
||||
|
||||
@@ -148,7 +148,7 @@ export default function Security(props: Props) {
|
||||
Security.layout = {
|
||||
breadcrumbs: [
|
||||
{
|
||||
title: 'Security settings',
|
||||
title: 'Segurança da conta',
|
||||
href: edit(),
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user