Skip to content

Commit 6a7aa3f

Browse files
feat: améliorer l'interface de connexion et de changement de mot de passe avec des messages d'accueil et des styles mis à jour
1 parent c804f6e commit 6a7aa3f

1 file changed

Lines changed: 21 additions & 15 deletions

File tree

frontend/src/pages/Index.tsx

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,8 @@ function VaultPage({ token, onLogout }: { token: string; onLogout: () => void })
456456
const Index = () => {
457457
const auth = useAuth();
458458

459-
const [loginUsername, setLoginUsername] = useState("admin");
460-
const [loginPassword, setLoginPassword] = useState("admin");
459+
const [loginUsername, setLoginUsername] = useState("");
460+
const [loginPassword, setLoginPassword] = useState("");
461461
const [loginLoading, setLoginLoading] = useState(false);
462462

463463
const [oldPassword, setOldPassword] = useState("");
@@ -505,17 +505,20 @@ const Index = () => {
505505
if (!auth.isAuthenticated) {
506506
return (
507507
<div className="min-h-screen bg-background flex items-center justify-center p-6">
508-
<div className="w-full max-w-sm rounded-lg border border-input bg-background p-6">
509-
<h1 className="text-lg font-semibold text-foreground mb-1">Sign in</h1>
510-
<p className="text-sm text-muted-foreground mb-5">Sign in to access your commands.</p>
508+
<div className="w-full max-w-md rounded-xl border border-border bg-card p-6 sm:p-8 shadow-lg">
509+
<div className="flex flex-col items-center text-center mb-6">
510+
<img src="/icon.png" alt="Command Keeper" className="h-12 w-auto" />
511+
<h1 className="text-xl font-semibold text-foreground mt-4">Welcome to Command Keeper</h1>
512+
<p className="text-sm text-muted-foreground mt-1">Sign in to access your command library.</p>
513+
</div>
511514

512515
<div className="space-y-3">
513516
<div>
514517
<label className="block text-xs text-muted-foreground mb-1">Username</label>
515518
<input
516519
value={loginUsername}
517520
onChange={(e) => setLoginUsername(e.target.value)}
518-
className="w-full px-3 py-2 text-sm rounded-md border border-input bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-accent-blue"
521+
className="w-full px-3 py-2.5 text-sm rounded-md border border-input bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-accent-blue"
519522
/>
520523
</div>
521524
<div>
@@ -524,13 +527,13 @@ const Index = () => {
524527
type="password"
525528
value={loginPassword}
526529
onChange={(e) => setLoginPassword(e.target.value)}
527-
className="w-full px-3 py-2 text-sm rounded-md border border-input bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-accent-blue"
530+
className="w-full px-3 py-2.5 text-sm rounded-md border border-input bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-accent-blue"
528531
/>
529532
</div>
530533
<button
531534
disabled={loginLoading}
532535
onClick={handleLogin}
533-
className="w-full px-4 py-2 text-sm rounded-md bg-accent-blue text-accent-blue-foreground hover:opacity-90 disabled:opacity-60 transition-all font-medium"
536+
className="w-full px-4 py-2.5 text-sm rounded-md bg-accent-blue text-accent-blue-foreground hover:opacity-90 disabled:opacity-60 transition-all font-medium"
534537
>
535538
{loginLoading ? "Signing in..." : "Sign in"}
536539
</button>
@@ -543,9 +546,12 @@ const Index = () => {
543546
if (auth.mustChangePassword) {
544547
return (
545548
<div className="min-h-screen bg-background flex items-center justify-center p-6">
546-
<div className="w-full max-w-sm rounded-lg border border-input bg-background p-6">
547-
<h1 className="text-lg font-semibold text-foreground mb-1">Change password</h1>
548-
<p className="text-sm text-muted-foreground mb-5">Required on your first login.</p>
549+
<div className="w-full max-w-md rounded-xl border border-border bg-card p-6 sm:p-8 shadow-lg">
550+
<div className="flex flex-col items-center text-center mb-6">
551+
<img src="/icon.png" alt="Command Keeper" className="h-12 w-auto" />
552+
<h1 className="text-xl font-semibold text-foreground mt-4">Change your password</h1>
553+
<p className="text-sm text-muted-foreground mt-1">Required on your first login.</p>
554+
</div>
549555

550556
<div className="space-y-3">
551557
<div>
@@ -554,7 +560,7 @@ const Index = () => {
554560
type="password"
555561
value={oldPassword}
556562
onChange={(e) => setOldPassword(e.target.value)}
557-
className="w-full px-3 py-2 text-sm rounded-md border border-input bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-accent-blue"
563+
className="w-full px-3 py-2.5 text-sm rounded-md border border-input bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-accent-blue"
558564
/>
559565
</div>
560566
<div>
@@ -564,21 +570,21 @@ const Index = () => {
564570
value={newPassword}
565571
onChange={(e) => setNewPassword(e.target.value)}
566572
minLength={6}
567-
className="w-full px-3 py-2 text-sm rounded-md border border-input bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-accent-blue"
573+
className="w-full px-3 py-2.5 text-sm rounded-md border border-input bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-accent-blue"
568574
/>
569575
<p className="text-[11px] text-muted-foreground mt-1">Minimum 6 characters.</p>
570576
</div>
571577
<button
572578
disabled={!canSubmitPasswordChange}
573579
onClick={handleChangePassword}
574-
className="w-full px-4 py-2 text-sm rounded-md bg-accent-blue text-accent-blue-foreground hover:opacity-90 disabled:opacity-60 transition-all font-medium"
580+
className="w-full px-4 py-2.5 text-sm rounded-md bg-accent-blue text-accent-blue-foreground hover:opacity-90 disabled:opacity-60 transition-all font-medium"
575581
>
576582
{changeLoading ? "Updating..." : "Update"}
577583
</button>
578584

579585
<button
580586
onClick={() => auth.logout()}
581-
className="w-full px-4 py-2 text-sm rounded-md border border-input hover:bg-surface-hover transition-colors"
587+
className="w-full px-4 py-2.5 text-sm rounded-md border border-input hover:bg-surface-hover transition-colors"
582588
>
583589
Sign out
584590
</button>

0 commit comments

Comments
 (0)