Secure Sakani portal and show full album titles

This commit is contained in:
Leon Tonhäuser committed 2026-11-30 19:14:57 +01:00
1 parent c40ccf77cf
commit 69264ce165
49 files changed
+1362 -601

No files matched your search

+9 -10
View File
@@ -46,8 +46,8 @@ export function TwoFactorWizard({ initiallyEnabled }: { initiallyEnabled: boolea
setError(undefined);
try {
const formData = new FormData(event.currentTarget);
const code = String(formData.get("code") ?? "").replace(/\s+/g, "");
const input = event.currentTarget.querySelector<HTMLInputElement>("#mfa-code");
const code = input?.value.replace(/\s+/g, "") ?? "";
const result = await authClient.twoFactor.verifyTotp({ code });
if (result.error) {
setError("Der Code ist ungültig. Bitte prüfen Sie Ihre Authenticator-App.");
@@ -86,12 +86,12 @@ export function TwoFactorWizard({ initiallyEnabled }: { initiallyEnabled: boolea
return (
<div className="flex flex-col gap-6">
{!enabled && step === "password" && (
<form onSubmit={startSetup} className="flex flex-col items-start gap-4">
<form method="post" onSubmit={startSetup} className="flex flex-col items-start gap-4">
<div className="w-full">
<Input
autoComplete="current-password"
label="Passwort bestätigen, um die Einrichtung zu starten"
name="password"
id="mfa-password"
required
type="password"
/>
@@ -132,14 +132,14 @@ export function TwoFactorWizard({ initiallyEnabled }: { initiallyEnabled: boolea
</div>
)}
<form onSubmit={confirmCode} className="flex flex-col items-start gap-4">
<form method="post" onSubmit={confirmCode} className="flex flex-col items-start gap-4">
<div className="w-48">
<Input
autoComplete="one-time-code"
inputMode="numeric"
label="Code aus der App"
maxLength={6}
name="code"
id="mfa-code"
pattern="[0-9]*"
required
type="text"
@@ -165,13 +165,13 @@ export function TwoFactorWizard({ initiallyEnabled }: { initiallyEnabled: boolea
)}
{enabled && step !== "done" && (
<form onSubmit={disable} className="flex flex-col items-start gap-4 border-t border-[var(--color-border-subtle)] pt-6">
<form method="post" onSubmit={disable} className="flex flex-col items-start gap-4 border-t border-[var(--color-border-subtle)] pt-6">
<p className="text-sm text-[var(--color-fg-muted)]">
Zwei-Faktor ist aktiviert. Zum Deaktivieren Ihr Passwort eingeben – danach muss die
Einrichtung neu erfolgen, bevor Admin-Bereiche wieder zugänglich sind.
</p>
<div className="w-full">
<Input aria-label="Passwort" autoComplete="current-password" name="password" placeholder="Passwort" required type="password" />
<Input aria-label="Passwort" autoComplete="current-password" id="mfa-password" placeholder="Passwort" required type="password" />
</div>
<Button variant="outline" disabled={pending} type="submit">
{pending ? "Wird deaktiviert …" : "Zwei-Faktor deaktivieren"}
@@ -185,8 +185,7 @@ export function TwoFactorWizard({ initiallyEnabled }: { initiallyEnabled: boolea
}
function readPassword(form: HTMLFormElement): string {
const value = new FormData(form).get("password");
return typeof value === "string" ? value : "";
return form.querySelector<HTMLInputElement>("#mfa-password")?.value ?? "";
}
function twoFactorErrorMessage(code: string | undefined): string {