Privacy policy page (public), data export and account deletion in the profile
CI / test (push) Failing after 42s
CI / build (push) Skipped
CI / deploy (push) Skipped

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-17 11:55:08 +00:00
co-authored by Claude Opus 5.5
parent 0791998c13
commit 786696bb1e
7 changed files with 305 additions and 2 deletions
@@ -0,0 +1,71 @@
"use client";
import { useState } from "react";
import { api, errorText } from "@/lib/api";
/** GDPR: download all data, delete the account. */
export function AccountData() {
const [confirm, setConfirm] = useState(false);
const [typed, setTyped] = useState("");
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
async function remove() {
setBusy(true);
setError(null);
try {
await api("/me", { method: "DELETE", body: { confirm: "DELETE" } });
window.location.href = "/belepes";
} catch (e) {
setError(errorText(e));
setBusy(false);
}
}
return (
<div className="field" style={{ gap: 16 }}>
<div className="form-actions">
<a href="/api/v1/me/export" className="btn" download>
Adataim letöltése
</a>
<span className="hint">Minden adatod egy JSON-fájlban: fiók, képletek, elemzések, vásárlások.</span>
</div>
{confirm ? (
<div className="danger-box">
<p>
A fiókod végleg törlődik a képleteiddel, a felvett személyekkel és az összes elemzéssel együtt. Ez nem
vonható vissza. A megerősítéshez írd be: <strong>TÖRLÉS</strong>
</p>
<input
className="inp"
style={{ maxWidth: 240 }}
value={typed}
onChange={(e) => setTyped(e.target.value)}
aria-label="Írd be: TÖRLÉS"
autoComplete="off"
/>
<div className="form-actions">
<button type="button" className="btn btn-danger" onClick={remove} disabled={busy || typed.trim() !== "TÖRLÉS"}>
{busy ? "Törlés…" : "Fiók végleges törlése"}
</button>
<button type="button" className="btn btn-ghost" onClick={() => setConfirm(false)} disabled={busy}>
Mégse
</button>
</div>
{error && (
<p className="msg msg-error" role="alert">
{error}
</p>
)}
</div>
) : (
<div className="form-actions">
<button type="button" className="btn btn-ghost" style={{ color: "var(--danger)" }} onClick={() => setConfirm(true)}>
Fiók törlése
</button>
</div>
)}
</div>
);
}
+10
View File
@@ -1,9 +1,11 @@
import type { Metadata } from "next";
import Link from "next/link";
import { ROLE_LABELS, formatDate } from "@/lib/astro";
import { backendGet, requireMe } from "@/lib/server";
import type { Chart } from "@/lib/types";
import { AccountData } from "./AccountData";
import { BirthEditor } from "./BirthEditor";
import { ProfileForm } from "./ProfileForm";
@@ -80,6 +82,14 @@ export default async function ProfilePage() {
notice={me.birth_change.notice}
/>
</section>
<section className="card" aria-labelledby="adataim">
<h2 id="adataim">Adataim</h2>
<p className="muted">
Hogyan kezeljük az adataidat: <Link href="/adatvedelem">adatvédelmi tájékoztató</Link>.
</p>
<AccountData />
</section>
</main>
);
}