diff --git a/web/src/App.css b/web/src/App.css
index 7c6b56f..47d25ae 100644
--- a/web/src/App.css
+++ b/web/src/App.css
@@ -4872,3 +4872,30 @@
background: var(--bg-toolbar-1);
border: 1px solid var(--border);
}
+
+/* Master password unlock (main.tsx) */
+.ts-vault-dialog {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ padding: 16px;
+ min-width: 300px;
+}
+.ts-vault-dialog h3,
+.ts-vault-dialog p {
+ margin: 0;
+}
+.ts-vault-wrong {
+ color: var(--log-error);
+}
+.ts-master-form {
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ margin: 4px 0 4px 24px;
+ max-width: 320px;
+}
+.ts-master-note {
+ margin: 0;
+ font-size: 0.9em;
+}
diff --git a/web/src/App.tsx b/web/src/App.tsx
index b316876..fd395cd 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -141,6 +141,7 @@ import {
type SoundEventId,
} from "./sounds";
import { parseSoundpack } from "./soundpack";
+import { checkMasterPassword, isVaultUnlocked, removeMasterPassword, setMasterPassword } from "./vault";
import {
BUILTIN_PACK,
NO_SOUNDS_PACK,
@@ -6623,6 +6624,82 @@ function ChatPanel() {
);
}
+/** Options -> Sicherheit -> "Master Passwort benutzen" / "ändern" (vault.ts). */
+function MasterPasswordRow() {
+ const t = useT();
+ const [on, setOn] = useState(isVaultUnlocked);
+ // What the inline form is doing: turning it on, changing it, or turning it off.
+ const [mode, setMode] = useState<"enable" | "change" | "disable" | null>(null);
+ const [current, setCurrent] = useState("");
+ const [next, setNext] = useState("");
+ const [repeat, setRepeat] = useState("");
+ const [error, setError] = useState("");
+ const [busy, setBusy] = useState(false);
+ const open = (m: typeof mode) => {
+ setMode(m);
+ setCurrent("");
+ setNext("");
+ setRepeat("");
+ setError("");
+ };
+ const submit = async (e: React.FormEvent) => {
+ e.preventDefault();
+ if (mode !== "enable" && !(await checkMasterPassword(current))) return setError(t("vault.wrong"));
+ if (mode !== "disable" && next !== repeat) return setError(t("securitySettings.masterMismatch"));
+ setBusy(true);
+ if (mode === "disable") await removeMasterPassword();
+ else await setMasterPassword(next);
+ setBusy(false);
+ setOn(isVaultUnlocked());
+ setMode(null);
+ };
+ return (
+ <>
+
+
+
+
+ {mode && (
+
+ )}
+ >
+ );
+}
+
function SecurityPanel({ onOpenIdentities, onClearCache }: { onOpenIdentities: () => void; onClearCache: () => void }) {
const t = useT();
const { security, setSecurity } = useContext(DisplayPrefsContext);
@@ -6652,13 +6729,7 @@ function SecurityPanel({ onOpenIdentities, onClearCache }: { onOpenIdentities: (
{t("securitySettings.clearChannelPasswords")}
-
-
-
-
+