Einstellungen: Passwort ändern
POST /api/user/password prüft das bisherige Passwort, setzt das neue (Regeln wie bei der Registrierung) und beendet alle anderen Sessions; die eigene bleibt. Pro IP gedrosselt wie der Login. Im Profil heißt der Knopf unter der Beschreibung jetzt "Text speichern". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TiXsPUqw7oeomZ8wZrQW5q
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
726f5491ff
commit
2275ff1a71
@@ -4,7 +4,7 @@ import { useAuthChanged, useMe } from "../auth";
|
||||
import { useFormAction } from "../useFormAction";
|
||||
import { AuthBox } from "../components/AuthBox";
|
||||
|
||||
// SettingsPage: Kontoeinstellungen (Name, Löschen). Profilbild, Header und
|
||||
// SettingsPage: Kontoeinstellungen (Name, Passwort, Löschen). Profilbild, Header und
|
||||
// Beschreibung bearbeitet man auf dem eigenen Profil.
|
||||
export function SettingsPage() {
|
||||
const me = useMe();
|
||||
@@ -31,6 +31,7 @@ function Settings() {
|
||||
form.reset();
|
||||
await refresh();
|
||||
});
|
||||
const password = useFormAction("/user/password", "Ändern fehlgeschlagen.", (form) => form.reset());
|
||||
const del = useFormAction("/user/delete", "Löschen fehlgeschlagen.", async () => {
|
||||
await refresh();
|
||||
navigate("/");
|
||||
@@ -48,6 +49,16 @@ function Settings() {
|
||||
<p className="msg" id="rename-msg">{rename.msg}</p>
|
||||
{rename.ok && <p className="muted">Name geändert.</p>}
|
||||
|
||||
<h3>Passwort ändern</h3>
|
||||
<form id="password-form" onSubmit={password.onSubmit}>
|
||||
<input name="pass" type="password" placeholder="Bisheriges Passwort" autoComplete="current-password" />{" "}
|
||||
<input name="pass1" type="password" placeholder="Neues Passwort" autoComplete="new-password" />{" "}
|
||||
<input name="pass2" type="password" placeholder="Neues Passwort wiederholen" autoComplete="new-password" />{" "}
|
||||
<button type="submit" disabled={password.busy}>Passwort ändern</button>
|
||||
</form>
|
||||
<p className="msg" id="password-msg">{password.msg}</p>
|
||||
{password.ok && <p className="muted">Passwort geändert. Andere Geräte sind abgemeldet.</p>}
|
||||
|
||||
<h3>Konto löschen</h3>
|
||||
<form
|
||||
id="delete-form"
|
||||
|
||||
@@ -123,7 +123,7 @@ function ProfileEdit({ info }: { info: Profile }) {
|
||||
<form id="bio-form" onSubmit={saveBio.onSubmit}>
|
||||
<textarea name="bio" rows={4} maxLength={maxBio} value={bio} onChange={(e) => setBio(e.target.value)} />
|
||||
<div className="row">
|
||||
<button type="submit" disabled={saveBio.busy}>Speichern</button>
|
||||
<button type="submit" disabled={saveBio.busy}>Text speichern</button>
|
||||
{saveBio.ok && bio === info.bio && <span className="muted">Gespeichert.</span>}
|
||||
<span className="muted counter">{[...bio].length}/{maxBio}</span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user