Código QR na adesão ao MFA e definições da conta em português
- A adesão à autenticação de dois factores passa a mostrar o código QR (endpoint do Fortify) com a chave manual como alternativa; antes só havia a chave para escrever à mão. - Definições, perfil, aparência, apagar conta e o botão de mostrar palavra-passe estavam em inglês (texto do kit inicial). 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 { appearance, updateAppearance } = useAppearance();
|
||||||
|
|
||||||
const tabs: { value: Appearance; icon: LucideIcon; label: string }[] = [
|
const tabs: { value: Appearance; icon: LucideIcon; label: string }[] = [
|
||||||
{ value: 'light', icon: Sun, label: 'Light' },
|
{ value: 'light', icon: Sun, label: 'Claro' },
|
||||||
{ value: 'dark', icon: Moon, label: 'Dark' },
|
{ value: 'dark', icon: Moon, label: 'Escuro' },
|
||||||
{ value: 'system', icon: Monitor, label: 'System' },
|
{ value: 'system', icon: Monitor, label: 'Sistema' },
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -23,14 +23,14 @@ export default function DeleteUser() {
|
|||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<Heading
|
<Heading
|
||||||
variant="small"
|
variant="small"
|
||||||
title="Delete account"
|
title="Apagar conta"
|
||||||
description="Delete your account and all of its resources"
|
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="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">
|
<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">
|
<p className="text-sm">
|
||||||
Please proceed with caution, this cannot be undone.
|
Proceda com cuidado: esta acção não pode ser desfeita.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -40,18 +40,17 @@ export default function DeleteUser() {
|
|||||||
variant="destructive"
|
variant="destructive"
|
||||||
data-test="delete-user-button"
|
data-test="delete-user-button"
|
||||||
>
|
>
|
||||||
Delete account
|
Apagar conta
|
||||||
</Button>
|
</Button>
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<DialogTitle>
|
<DialogTitle>
|
||||||
Are you sure you want to delete your account?
|
Tem a certeza de que quer apagar a sua conta?
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
<DialogDescription>
|
<DialogDescription>
|
||||||
Once your account is deleted, all of its resources
|
Depois de apagada, a conta e todos os seus dados são
|
||||||
and data will also be permanently deleted. Please
|
eliminados de forma permanente. Introduza a
|
||||||
enter your password to confirm you would like to
|
palavra-passe para confirmar.
|
||||||
permanently delete your account.
|
|
||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
|
|
||||||
<Form
|
<Form
|
||||||
@@ -70,14 +69,14 @@ export default function DeleteUser() {
|
|||||||
htmlFor="password"
|
htmlFor="password"
|
||||||
className="sr-only"
|
className="sr-only"
|
||||||
>
|
>
|
||||||
Password
|
Palavra-passe
|
||||||
</Label>
|
</Label>
|
||||||
|
|
||||||
<PasswordInput
|
<PasswordInput
|
||||||
id="password"
|
id="password"
|
||||||
name="password"
|
name="password"
|
||||||
ref={passwordInput}
|
ref={passwordInput}
|
||||||
placeholder="Password"
|
placeholder="Palavra-passe"
|
||||||
autoComplete="current-password"
|
autoComplete="current-password"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -92,7 +91,7 @@ export default function DeleteUser() {
|
|||||||
resetAndClearErrors()
|
resetAndClearErrors()
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
Cancel
|
Cancelar
|
||||||
</Button>
|
</Button>
|
||||||
</DialogClose>
|
</DialogClose>
|
||||||
|
|
||||||
@@ -105,7 +104,7 @@ export default function DeleteUser() {
|
|||||||
type="submit"
|
type="submit"
|
||||||
data-test="confirm-delete-user-button"
|
data-test="confirm-delete-user-button"
|
||||||
>
|
>
|
||||||
Delete account
|
Apagar conta
|
||||||
</button>
|
</button>
|
||||||
</Button>
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
|
|||||||
@@ -23,7 +23,11 @@ export default function PasswordInput({
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={() => setShowPassword((prev) => !prev)}
|
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"
|
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}
|
tabIndex={-1}
|
||||||
>
|
>
|
||||||
{showPassword ? (
|
{showPassword ? (
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export default function TwoFactorManagement({
|
|||||||
const [enabled, setEnabled] = useState(initialEnabled);
|
const [enabled, setEnabled] = useState(initialEnabled);
|
||||||
const [pending, setPending] = useState(initialPending);
|
const [pending, setPending] = useState(initialPending);
|
||||||
const [secret, setSecret] = useState('');
|
const [secret, setSecret] = useState('');
|
||||||
|
const [qrSvg, setQrSvg] = useState('');
|
||||||
const [code, setCode] = useState('');
|
const [code, setCode] = useState('');
|
||||||
const [codes, setCodes] = useState<string[]>([]);
|
const [codes, setCodes] = useState<string[]>([]);
|
||||||
const [busy, setBusy] = useState(false);
|
const [busy, setBusy] = useState(false);
|
||||||
@@ -76,8 +77,12 @@ export default function TwoFactorManagement({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const loadSecret = async () => {
|
const loadSecret = async () => {
|
||||||
const data = await request('/user/two-factor-secret-key');
|
const [key, qr] = await Promise.all([
|
||||||
setSecret(data.secretKey);
|
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 () => {
|
const loadCodes = async () => {
|
||||||
setCodes(await request('/user/two-factor-recovery-codes'));
|
setCodes(await request('/user/two-factor-recovery-codes'));
|
||||||
@@ -130,8 +135,22 @@ export default function TwoFactorManagement({
|
|||||||
{pending && secret && (
|
{pending && secret && (
|
||||||
<>
|
<>
|
||||||
<p className="text-sm">
|
<p className="text-sm">
|
||||||
Na aplicação autenticadora, adicione uma conta com esta
|
Na aplicação autenticadora (por exemplo Google
|
||||||
chave manual. Não partilhe esta chave.
|
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>
|
</p>
|
||||||
<code className="block rounded bg-muted p-3 break-all">
|
<code className="block rounded bg-muted p-3 break-all">
|
||||||
{secret}
|
{secret}
|
||||||
@@ -149,6 +168,7 @@ export default function TwoFactorManagement({
|
|||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
setPending(false);
|
setPending(false);
|
||||||
setSecret('');
|
setSecret('');
|
||||||
|
setQrSvg('');
|
||||||
setCode('');
|
setCode('');
|
||||||
await loadCodes();
|
await loadCodes();
|
||||||
});
|
});
|
||||||
@@ -240,6 +260,7 @@ export default function TwoFactorManagement({
|
|||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
setPending(false);
|
setPending(false);
|
||||||
setSecret('');
|
setSecret('');
|
||||||
|
setQrSvg('');
|
||||||
setCode('');
|
setCode('');
|
||||||
setCodes([]);
|
setCodes([]);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -12,17 +12,17 @@ import type { NavItem } from '@/types';
|
|||||||
|
|
||||||
const sidebarNavItems: NavItem[] = [
|
const sidebarNavItems: NavItem[] = [
|
||||||
{
|
{
|
||||||
title: 'Profile',
|
title: 'Perfil',
|
||||||
href: edit(),
|
href: edit(),
|
||||||
icon: null,
|
icon: null,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Security',
|
title: 'Segurança',
|
||||||
href: editSecurity(),
|
href: editSecurity(),
|
||||||
icon: null,
|
icon: null,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Appearance',
|
title: 'Aparência',
|
||||||
href: editAppearance(),
|
href: editAppearance(),
|
||||||
icon: null,
|
icon: null,
|
||||||
},
|
},
|
||||||
@@ -34,15 +34,15 @@ export default function SettingsLayout({ children }: PropsWithChildren) {
|
|||||||
return (
|
return (
|
||||||
<div className="px-4 py-6">
|
<div className="px-4 py-6">
|
||||||
<Heading
|
<Heading
|
||||||
title="Settings"
|
title="Definições"
|
||||||
description="Manage your profile and account settings"
|
description="Gerir o perfil e a segurança da sua conta"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="flex flex-col lg:flex-row lg:space-x-12">
|
<div className="flex flex-col lg:flex-row lg:space-x-12">
|
||||||
<aside className="w-full max-w-xl lg:w-48">
|
<aside className="w-full max-w-xl lg:w-48">
|
||||||
<nav
|
<nav
|
||||||
className="flex flex-col space-y-1 space-x-0"
|
className="flex flex-col space-y-1 space-x-0"
|
||||||
aria-label="Settings"
|
aria-label="Definições"
|
||||||
>
|
>
|
||||||
{sidebarNavItems.map((item, index) => (
|
{sidebarNavItems.map((item, index) => (
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -6,15 +6,15 @@ import { edit as editAppearance } from '@/routes/appearance';
|
|||||||
export default function Appearance() {
|
export default function Appearance() {
|
||||||
return (
|
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">
|
<div className="space-y-6">
|
||||||
<Heading
|
<Heading
|
||||||
variant="small"
|
variant="small"
|
||||||
title="Appearance settings"
|
title="Aparência"
|
||||||
description="Update the appearance settings for your account"
|
description="Escolha o tema da aplicação neste dispositivo"
|
||||||
/>
|
/>
|
||||||
<AppearanceTabs />
|
<AppearanceTabs />
|
||||||
</div>
|
</div>
|
||||||
@@ -25,7 +25,7 @@ export default function Appearance() {
|
|||||||
Appearance.layout = {
|
Appearance.layout = {
|
||||||
breadcrumbs: [
|
breadcrumbs: [
|
||||||
{
|
{
|
||||||
title: 'Appearance settings',
|
title: 'Aparência',
|
||||||
href: editAppearance(),
|
href: editAppearance(),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -18,15 +18,15 @@ export default function Profile() {
|
|||||||
|
|
||||||
return (
|
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">
|
<div className="space-y-6">
|
||||||
<Heading
|
<Heading
|
||||||
variant="small"
|
variant="small"
|
||||||
title="Profile"
|
title="Perfil"
|
||||||
description="Update your name and email address"
|
description="Actualize o seu nome e endereço de email"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Form
|
<Form
|
||||||
@@ -39,7 +39,7 @@ export default function Profile() {
|
|||||||
{({ processing, errors }) => (
|
{({ processing, errors }) => (
|
||||||
<>
|
<>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="name">Name</Label>
|
<Label htmlFor="name">Nome</Label>
|
||||||
|
|
||||||
<Input
|
<Input
|
||||||
id="name"
|
id="name"
|
||||||
@@ -48,7 +48,7 @@ export default function Profile() {
|
|||||||
name="name"
|
name="name"
|
||||||
required
|
required
|
||||||
autoComplete="name"
|
autoComplete="name"
|
||||||
placeholder="Full name"
|
placeholder="Nome completo"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<InputError
|
<InputError
|
||||||
@@ -58,7 +58,7 @@ export default function Profile() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="email">Email address</Label>
|
<Label htmlFor="email">Endereço de email</Label>
|
||||||
|
|
||||||
<Input
|
<Input
|
||||||
id="email"
|
id="email"
|
||||||
@@ -68,7 +68,7 @@ export default function Profile() {
|
|||||||
name="email"
|
name="email"
|
||||||
required
|
required
|
||||||
autoComplete="username"
|
autoComplete="username"
|
||||||
placeholder="Email address"
|
placeholder="Endereço de email"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<InputError
|
<InputError
|
||||||
@@ -82,7 +82,7 @@ export default function Profile() {
|
|||||||
disabled={processing}
|
disabled={processing}
|
||||||
data-test="update-profile-button"
|
data-test="update-profile-button"
|
||||||
>
|
>
|
||||||
Save
|
Guardar
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
@@ -98,7 +98,7 @@ export default function Profile() {
|
|||||||
Profile.layout = {
|
Profile.layout = {
|
||||||
breadcrumbs: [
|
breadcrumbs: [
|
||||||
{
|
{
|
||||||
title: 'Profile settings',
|
title: 'Perfil',
|
||||||
href: edit(),
|
href: edit(),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ export default function Security(props: Props) {
|
|||||||
Security.layout = {
|
Security.layout = {
|
||||||
breadcrumbs: [
|
breadcrumbs: [
|
||||||
{
|
{
|
||||||
title: 'Security settings',
|
title: 'Segurança da conta',
|
||||||
href: edit(),
|
href: edit(),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user