Files
DungeonsDragons/frontend/src/pages/ResetPassword.tsx
T
Thorsten 624644619c Add character detail, markdown rendering, wider layout, and LLM provider switch
- Character sheets gain structured combat_stats, abilities (name +
  plain-language explanation), and equipment fields, populated by the
  upsert_character_sheet tool; the detail page renders them as their
  own sections instead of one prose block, with a player-card-style
  attribute grid (full ability names + modifiers).
- Fix double-escaped unicode occasionally left in tool-call JSON
  arguments (a model quirk) and stop the app's own json.dumps calls
  from re-introducing it (ensure_ascii=False).
- Render chat messages as markdown (react-markdown + Tailwind
  typography) instead of raw text, and widen the games/characters/
  chat layout to use more of the screen on desktop.
- Sharpen the DM system prompt: state the ability + DC for each
  offered action option before the player commits, and narrate rolls
  as DC → result → pass/fail before the story consequence; also stop
  re-asking Session-0 questions already answered in the game's
  name/description.
- Make the DM's LLM provider configurable (xai default, lmstudio for
  a local OpenAI-compatible server via host.docker.internal) instead
  of hardcoded to x.ai.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-01 15:18:15 +02:00

65 lines
2.0 KiB
TypeScript

import { FormEvent, useState } from "react";
import { Link, useNavigate, useSearchParams } from "react-router-dom";
import { resetPassword } from "../api/auth";
export default function ResetPassword() {
const [searchParams] = useSearchParams();
const token = searchParams.get("token") ?? "";
const navigate = useNavigate();
const [password, setPassword] = useState("");
const [error, setError] = useState<string | null>(null);
const [done, setDone] = useState(false);
async function handleSubmit(e: FormEvent) {
e.preventDefault();
setError(null);
try {
await resetPassword(token, password);
setDone(true);
setTimeout(() => navigate("/login"), 1500);
} catch {
setError("Zurücksetzen fehlgeschlagen. Der Link ist evtl. abgelaufen.");
}
}
if (!token) {
return (
<div className="mx-auto mt-16 max-w-md px-4 text-slate-300">
Kein gültiger Reset-Link.{" "}
<Link to="/forgot-password" className="text-amber-400">
Neu anfordern
</Link>
</div>
);
}
return (
<div className="mx-auto mt-16 max-w-md px-4">
<h1 className="mb-6 text-2xl font-bold text-amber-400">Neues Passwort setzen</h1>
{done ? (
<p className="text-slate-300">Passwort geändert. Du wirst weitergeleitet…</p>
) : (
<form onSubmit={handleSubmit} className="flex flex-col gap-4">
<input
type="password"
required
minLength={8}
placeholder="Neues Passwort"
value={password}
onChange={(e) => setPassword(e.target.value)}
className="rounded bg-slate-800 px-3 py-2 outline-none focus:ring-2 focus:ring-amber-400"
/>
{error && <p className="text-sm text-red-400">{error}</p>}
<button
type="submit"
className="rounded bg-amber-500 px-3 py-2 font-semibold text-slate-950 hover:bg-amber-400"
>
Passwort setzen
</button>
</form>
)}
</div>
);
}