fix: improve account password autofill semantics and settings layout
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 5m11s

This commit is contained in:
2026-02-28 21:44:28 +01:00
parent 41faa30453
commit 0cb51ce99d
3 changed files with 48 additions and 25 deletions

View File

@@ -25,7 +25,7 @@ export default async function AccountPage() {
<div className="grid gap-6 md:grid-cols-2"> <div className="grid gap-6 md:grid-cols-2">
<UserProfileCard profile={{ ...profile, stats }} /> <UserProfileCard profile={{ ...profile, stats }} />
<ChangePasswordForm /> <ChangePasswordForm username={profile.email} />
</div> </div>
</div> </div>
</div> </div>

View File

@@ -9,7 +9,11 @@ import { useToast } from "@/components/ui/use-toast";
import { Lock } from "lucide-react"; import { Lock } from "lucide-react";
import { changePassword } from "@/app/actions/password"; import { changePassword } from "@/app/actions/password";
export function ChangePasswordForm() { interface ChangePasswordFormProps {
username?: string;
}
export function ChangePasswordForm({ username }: ChangePasswordFormProps) {
const [currentPassword, setCurrentPassword] = useState(""); const [currentPassword, setCurrentPassword] = useState("");
const [newPassword, setNewPassword] = useState(""); const [newPassword, setNewPassword] = useState("");
const [confirmPassword, setConfirmPassword] = useState(""); const [confirmPassword, setConfirmPassword] = useState("");
@@ -77,13 +81,26 @@ export function ChangePasswordForm() {
</CardHeader> </CardHeader>
<CardContent> <CardContent>
<form onSubmit={handleSubmit} className="space-y-4"> <form onSubmit={handleSubmit} className="space-y-4">
<Input
type="text"
name="username"
autoComplete="username"
value={username || ""}
readOnly
tabIndex={-1}
aria-hidden="true"
className="sr-only"
/>
<div className="space-y-2"> <div className="space-y-2">
<Label htmlFor="currentPassword">Mot de passe actuel</Label> <Label htmlFor="currentPassword">Mot de passe actuel</Label>
<div className="relative"> <div className="relative">
<Lock className="absolute left-3 top-3 h-4 w-4 text-muted-foreground" /> <Lock className="absolute left-3 top-3 h-4 w-4 text-muted-foreground" />
<Input <Input
id="currentPassword" id="currentPassword"
name="currentPassword"
type="password" type="password"
autoComplete="current-password"
value={currentPassword} value={currentPassword}
onChange={(e) => setCurrentPassword(e.target.value)} onChange={(e) => setCurrentPassword(e.target.value)}
className="pl-9" className="pl-9"
@@ -99,7 +116,9 @@ export function ChangePasswordForm() {
<Lock className="absolute left-3 top-3 h-4 w-4 text-muted-foreground" /> <Lock className="absolute left-3 top-3 h-4 w-4 text-muted-foreground" />
<Input <Input
id="newPassword" id="newPassword"
name="newPassword"
type="password" type="password"
autoComplete="new-password"
value={newPassword} value={newPassword}
onChange={(e) => setNewPassword(e.target.value)} onChange={(e) => setNewPassword(e.target.value)}
className="pl-9" className="pl-9"
@@ -115,7 +134,9 @@ export function ChangePasswordForm() {
<Lock className="absolute left-3 top-3 h-4 w-4 text-muted-foreground" /> <Lock className="absolute left-3 top-3 h-4 w-4 text-muted-foreground" />
<Input <Input
id="confirmPassword" id="confirmPassword"
name="confirmPassword"
type="password" type="password"
autoComplete="new-password"
value={confirmPassword} value={confirmPassword}
onChange={(e) => setConfirmPassword(e.target.value)} onChange={(e) => setConfirmPassword(e.target.value)}
className="pl-9" className="pl-9"

View File

@@ -20,7 +20,8 @@ export function ClientSettings({ initialConfig, initialLibraries }: ClientSettin
const { t } = useTranslate(); const { t } = useTranslate();
return ( return (
<div className="container mx-auto px-4 py-8 space-y-6"> <div className="container mx-auto px-4 py-8">
<div className="max-w-4xl mx-auto space-y-8">
<h1 className="text-3xl font-bold">{t("settings.title")}</h1> <h1 className="text-3xl font-bold">{t("settings.title")}</h1>
<Tabs defaultValue="display" className="w-full"> <Tabs defaultValue="display" className="w-full">
@@ -47,5 +48,6 @@ export function ClientSettings({ initialConfig, initialLibraries }: ClientSettin
</TabsContent> </TabsContent>
</Tabs> </Tabs>
</div> </div>
</div>
); );
} }