mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
feat(dashboard): unify secure staff administration
Provide a single /dashboard entry point for owner and staff tools, with Discord OAuth sign-in for approved owner accounts and active staff. Add owner-managed dashboard access grants, staff server health and update visibility, filtering, moderation improvements, item controls, and per-animal clothing restrictions. Replace staff-triggered password and 2FA resets with email-verified account recovery. Persist validated recovery addresses, use short-lived hashed recovery tokens, expose recovery flows in registration and account pages, and keep mail delivery disabled until its webhook configuration is present. Cover dashboard aliases, recovery restrictions, Discord access, monitoring, item locks, wear rules, and staff behavior with regression tests.
This commit is contained in:
1 parent
4997315239
commit
7dee29010a
27 files changed
+2303
-346
No files matched your search
+1
-1
@@ -198,7 +198,7 @@
|
||||
<div class="row"><button class="primary" type="submit">Sign in</button></div>
|
||||
</form>
|
||||
<p class="status" id="gate-status" role="status"></p>
|
||||
<p class="hint" style="margin:10px 0 0">No account yet? <a href="/register">Create one</a></p>
|
||||
<p class="hint" style="margin:10px 0 0">No account yet? <a href="/register">Create one</a> · <a href="/account/recover">Forgot password or 2FA?</a></p>
|
||||
</div>
|
||||
|
||||
<div id="page" hidden>
|
||||
|
||||
+183
-11
@@ -143,6 +143,14 @@
|
||||
.lock-results .meta { color: var(--muted); font-size: 12px; }
|
||||
.lock-results button { margin-left: auto; }
|
||||
.lock-results .is-locked { font-size: 11px; padding: 1px 7px; border: 1px solid var(--text); border-radius: 999px; }
|
||||
#wear-rule-animals { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; }
|
||||
#wear-rule-animals label.check { display: inline-flex; align-items: center; gap: 5px; }
|
||||
#wear-rule-animal { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
|
||||
#wear-rule-animal button { margin: 0; }
|
||||
#wear-rule-animal button[aria-pressed="true"] { color: #000; background: var(--text); border-color: var(--text); }
|
||||
#wear-rule-results li, #wear-rule-active li { display: flex; gap: 10px; align-items: center; }
|
||||
#wear-rule-results .meta, #wear-rule-active .meta { color: var(--muted); font-size: 12px; }
|
||||
#wear-rule-results button, #wear-rule-active button { margin-left: auto; }
|
||||
|
||||
/* signing in */
|
||||
#gate {
|
||||
@@ -368,6 +376,8 @@
|
||||
</div>
|
||||
<button class="primary" id="gate-button">Sign in</button>
|
||||
</form>
|
||||
<button type="button" id="discord-sign-in" hidden>Sign in with Discord</button>
|
||||
<p class="hint" id="discord-gate-hint" hidden>Only Discord accounts explicitly allowed by the owner can use this.</p>
|
||||
<p class="status" id="gate-status" role="status"></p>
|
||||
</main>
|
||||
|
||||
@@ -375,7 +385,7 @@
|
||||
<aside id="side">
|
||||
<div class="brand">
|
||||
<img class="mark" src="/logo.png" alt="">
|
||||
<div><h1>Server admin</h1><span class="hint" id="updated"></span></div>
|
||||
<div><h1>Burrow dashboard</h1><span class="hint" id="updated">Owner controls</span></div>
|
||||
</div>
|
||||
<nav role="tablist" aria-orientation="vertical">
|
||||
<button role="tab" data-tab="overview" aria-selected="true"><span class="icon" aria-hidden="true">◉</span>Overview</button>
|
||||
@@ -386,6 +396,7 @@
|
||||
<button role="tab" data-tab="support" aria-selected="false"><span class="icon" aria-hidden="true">✎</span>Requests<span id="support-count"></span></button>
|
||||
<button role="tab" data-tab="masterpieces" aria-selected="false"><span class="icon" aria-hidden="true">▣</span>Masterpieces<span id="masterpiece-count"></span></button>
|
||||
<button role="tab" data-tab="items" aria-selected="false"><span class="icon" aria-hidden="true">❖</span>Items</button>
|
||||
<button role="tab" data-tab="wear-rules" aria-selected="false"><span class="icon" aria-hidden="true">⚑</span>Wear rules</button>
|
||||
<button role="tab" data-tab="bans" aria-selected="false"><span class="icon" aria-hidden="true">⊘</span>Bans</button>
|
||||
<button role="tab" data-tab="moderators" aria-selected="false"><span class="icon" aria-hidden="true">★</span>Moderators</button>
|
||||
<button role="tab" data-tab="messages" aria-selected="false"><span class="icon" aria-hidden="true">✉</span>Messages</button>
|
||||
@@ -474,11 +485,6 @@
|
||||
<div class="row"><input id="new-name" maxlength="100" placeholder="New username" autocomplete="off" spellcheck="false" aria-label="New username">
|
||||
<button type="button" data-action="rename">Rename</button></div>
|
||||
</div>
|
||||
<div class="action">
|
||||
<h3>Password</h3>
|
||||
<div class="row"><input id="new-password" type="password" placeholder="New password" autocomplete="new-password" aria-label="New password">
|
||||
<button type="button" data-action="password">Set</button></div>
|
||||
</div>
|
||||
<div class="action">
|
||||
<h3>Adventure level</h3>
|
||||
<div class="row"><input id="quest-level" type="number" min="0" max="100" step="1" aria-label="Adventure level of the animal in use">
|
||||
@@ -564,7 +570,6 @@
|
||||
<div class="buttons">
|
||||
<button type="button" data-action="kick">Disconnect</button>
|
||||
<button type="button" data-action="unlock">Unlock</button>
|
||||
<button type="button" data-action="twoStepOff">Turn off 2FA</button>
|
||||
<button type="button" data-action="rejectName">Reject username</button>
|
||||
<button type="button" data-action="acceptName">Take rejection back</button>
|
||||
<button type="button" data-action="moderator" id="moderator-toggle">Make moderator</button>
|
||||
@@ -617,6 +622,8 @@
|
||||
<p class="hint">Each one as their role has it, or given or taken for them alone. What they may do now is marked.</p>
|
||||
<div class="perm-list" id="perm-list"></div>
|
||||
<div class="row" style="margin-top:10px"><button type="button" class="primary" data-action="permissions">Save permissions</button></div>
|
||||
<div class="row" style="margin-top:12px"><button type="button" data-action="adminDashboardAccess" id="admin-dashboard-access"></button></div>
|
||||
<p class="hint" id="admin-dashboard-access-hint"></p>
|
||||
</div>
|
||||
<div id="owned"></div>
|
||||
</div>
|
||||
@@ -688,6 +695,30 @@
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div data-view="wear-rules" hidden>
|
||||
<section>
|
||||
<h2>Animal wear rules</h2>
|
||||
<p class="hint">Choose an animal below, then control which clothing it may wear. A rule never changes the other animals.</p>
|
||||
<div id="wear-rule-animal" aria-label="Animal to control"></div>
|
||||
<div class="toolbar"><input id="wear-rule-q" type="search" placeholder="Clothing name or id" aria-label="Find clothing to restrict" disabled></div>
|
||||
<ul class="plain lock-results" id="wear-rule-results"></ul>
|
||||
<p class="hint" id="wear-rule-more" hidden></p>
|
||||
</section>
|
||||
<section id="wear-rule-editor" hidden>
|
||||
<h2 id="wear-rule-title"></h2>
|
||||
<p class="hint">Tick every animal that must not wear this item. Leaving them all clear lets every animal wear it again.</p>
|
||||
<div id="wear-rule-animals"></div>
|
||||
<div class="toolbar" style="margin-top:14px"><button type="button" class="primary" id="wear-rule-save">Save rules</button>
|
||||
<button type="button" id="wear-rule-close">Close</button></div>
|
||||
<p class="status" id="wear-rule-status" role="status"></p>
|
||||
</section>
|
||||
<section>
|
||||
<h2>Restricted for this animal</h2>
|
||||
<ul class="plain lock-results" id="wear-rule-active"></ul>
|
||||
<div class="empty" id="no-wear-rules">No animal wear rules yet.</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div data-view="items" hidden>
|
||||
<section>
|
||||
<h2 id="item-form-title">Make an item</h2>
|
||||
@@ -973,7 +1004,7 @@
|
||||
let timer = null;
|
||||
|
||||
const api = async (path, body) => {
|
||||
const response = await fetch(`/admin/api/${path}`, body === undefined ? {} : {
|
||||
const response = await fetch(`/dashboard/api/admin/${path}`, body === undefined ? {} : {
|
||||
method: "POST",
|
||||
headers: {"Content-Type": "application/json"},
|
||||
body: JSON.stringify(body),
|
||||
@@ -1040,6 +1071,13 @@
|
||||
$("confirm-field").hidden = !setup;
|
||||
$("code-field").hidden = !(setup && state.needsSetupCode);
|
||||
$("gate-button").textContent = setup ? "Set password" : "Sign in";
|
||||
$("discord-sign-in").hidden = setup;
|
||||
$("discord-sign-in").disabled = !state.discordLogin;
|
||||
$("discord-sign-in").textContent = state.discordLogin ? "Sign in with Discord" : "Discord sign-in is not configured";
|
||||
$("discord-gate-hint").hidden = setup;
|
||||
$("discord-gate-hint").textContent = state.discordLogin
|
||||
? "Only Discord accounts explicitly allowed by the owner can use this."
|
||||
: "Set AJ_DISCORD_CLIENT_ID and AJ_DISCORD_CLIENT_SECRET, then add both admin callback URLs in your Discord application.";
|
||||
$("password").value = "";
|
||||
$("confirm").value = "";
|
||||
setStatus($("gate-status"), message || "");
|
||||
@@ -1065,6 +1103,9 @@
|
||||
state = {needsSetup: false, needsSetupCode: false, signedIn: true};
|
||||
showPanel();
|
||||
});
|
||||
$("discord-sign-in").addEventListener("click", () => {
|
||||
location.href = "/dashboard/admin/discord/login";
|
||||
});
|
||||
|
||||
$("sign-out").addEventListener("click", async () => {
|
||||
await api("logout", {});
|
||||
@@ -1443,6 +1484,11 @@
|
||||
return label;
|
||||
}));
|
||||
$("discord-name").textContent = current && current.discord ? `Discord: ${current.discord}` : "No Discord linked";
|
||||
$("admin-dashboard-access").textContent = current && current.adminDashboardAccess ? "Remove Discord dashboard access" : "Allow Discord dashboard access";
|
||||
$("admin-dashboard-access").disabled = !current || (!current.discord && !current.adminDashboardAccess);
|
||||
$("admin-dashboard-access-hint").textContent = current && current.discord
|
||||
? "Lets this linked Discord account open the full owner dashboard without the shared admin password."
|
||||
: "They must link Discord on their account page first.";
|
||||
$("bio-text").value = current ? current.bio : "";
|
||||
$("quest-level").value = current ? current.level : "";
|
||||
$("ban-reason").value = current ? current.banReason : "";
|
||||
@@ -1473,7 +1519,7 @@
|
||||
selected = username;
|
||||
current = null;
|
||||
setStatus($("detail-status"), "");
|
||||
for (const id of ["new-name", "new-password", "ban-hours", "silence-hours", "message-text", "gems-amount", "gift-value", "gift-text"]) {
|
||||
for (const id of ["new-name", "ban-hours", "silence-hours", "message-text", "gems-amount", "gift-value", "gift-text"]) {
|
||||
$(id).value = "";
|
||||
}
|
||||
hashArg = username;
|
||||
@@ -1618,7 +1664,6 @@
|
||||
const actionBody = action => {
|
||||
switch (action) {
|
||||
case "rename": return {newName: $("new-name").value};
|
||||
case "password": return {password: $("new-password").value};
|
||||
case "lastSeen": return {when: Math.floor(new Date($("last-seen").value).getTime() / 1000)};
|
||||
case "ban": return {hours: numberFrom("ban-hours"), reason: $("ban-reason").value};
|
||||
case "banReason": case "banDevices": return {reason: $("ban-reason").value};
|
||||
@@ -1626,6 +1671,7 @@
|
||||
case "moderator": return {on: !(current || {}).moderator};
|
||||
case "role": return {role: $("role-select").value};
|
||||
case "permissions": return permissionChoices();
|
||||
case "adminDashboardAccess": return {on: !(current || {}).adminDashboardAccess};
|
||||
case "message": return {text: $("message-text").value};
|
||||
case "gems": return {amount: numberFrom("gems-amount")};
|
||||
case "gift": return giftBody();
|
||||
@@ -1678,7 +1724,6 @@
|
||||
$("new-name").value = "";
|
||||
}
|
||||
if (result.ok) {
|
||||
$("new-password").value = "";
|
||||
await refresh();
|
||||
fillCard();
|
||||
loadOwned();
|
||||
@@ -2590,6 +2635,130 @@
|
||||
file.click();
|
||||
};
|
||||
|
||||
// ---- animal wear rules: the same server-side moderation control the
|
||||
// moderator dashboard uses (items.restrict in lib/roles.js).
|
||||
let wearAnimals = [];
|
||||
let wearRuleEntries = [];
|
||||
let wearSelected = null;
|
||||
let wearSelectedTypes = new Set();
|
||||
let wearAnimal = "";
|
||||
let wearRuleTimer = null;
|
||||
let wearRuleAsked = 0;
|
||||
|
||||
const wearRuleFor = id => wearRuleEntries.find(rule => rule.id === Number(id));
|
||||
const wearAnimalName = id => (wearAnimals.find(animal => animal.id === Number(id)) || {name: `Animal ${id}`}).name;
|
||||
const wearNames = types => types.map(wearAnimalName).join(", ");
|
||||
const selectedWearAnimal = () => Number(wearAnimal) || 0;
|
||||
|
||||
const toggleWearRule = async item => {
|
||||
const animal = selectedWearAnimal();
|
||||
if (!animal) return;
|
||||
const current = item.blockedTypes || (wearRuleFor(item.id) || {}).blockedTypes || [];
|
||||
const blocked = current.includes(animal) ? current.filter(type => type !== animal) : [...current, animal];
|
||||
const result = await api("items/wear-rules", {id: item.id, blockedTypes: blocked.sort((one, two) => one - two)});
|
||||
setStatus($("wear-rule-status"), said(result), !result.ok);
|
||||
if (result.ok) await loadWearRules();
|
||||
};
|
||||
const chooseWearAnimal = animal => {
|
||||
wearAnimal = String(animal);
|
||||
wearSelected = null;
|
||||
$("wear-rule-q").disabled = !selectedWearAnimal();
|
||||
renderWearRuleEditor();
|
||||
loadWearRules();
|
||||
};
|
||||
|
||||
const renderWearRuleEditor = () => {
|
||||
$("wear-rule-editor").hidden = !wearSelected;
|
||||
if (!wearSelected) {
|
||||
return;
|
||||
}
|
||||
$("wear-rule-title").textContent = `Where ${wearSelected.name || `clothing ${wearSelected.id}`} cannot be worn`;
|
||||
$("wear-rule-animals").replaceChildren(...wearAnimals.map(animal => {
|
||||
const box = el("input");
|
||||
box.type = "checkbox";
|
||||
box.checked = wearSelectedTypes.has(animal.id);
|
||||
box.addEventListener("change", () => {
|
||||
wearSelectedTypes[box.checked ? "add" : "delete"](animal.id);
|
||||
});
|
||||
const label = el("label", undefined, "check");
|
||||
label.append(box, animal.name);
|
||||
return label;
|
||||
}));
|
||||
};
|
||||
|
||||
const chooseWearRule = item => {
|
||||
wearSelected = {id: Number(item.id), name: item.name || `clothing ${item.id}`};
|
||||
const current = item.blockedTypes || (wearRuleFor(item.id) || {}).blockedTypes || [];
|
||||
wearSelectedTypes = new Set(current);
|
||||
setStatus($("wear-rule-status"), "");
|
||||
renderWearRuleEditor();
|
||||
};
|
||||
|
||||
const renderWearRules = (results, query, total) => {
|
||||
const animal = selectedWearAnimal();
|
||||
$("wear-rule-results").replaceChildren(...results.map(item => {
|
||||
const row = el("li");
|
||||
const blocked = item.blockedTypes || (wearRuleFor(item.id) || {}).blockedTypes || [];
|
||||
row.append(el("span", item.name || "(no name)"), el("span", `clothing ${item.id}${item.custom ? ", custom" : ""}${blocked.length ? ` · blocked for ${wearNames(blocked)}` : ""}`, "meta"),
|
||||
button(animal && blocked.includes(animal) ? `Allow ${wearAnimalName(animal)}` : `Block ${wearAnimalName(animal)}`,
|
||||
() => toggleWearRule({...item, blockedTypes: blocked}), animal && blocked.includes(animal) ? "" : "primary"));
|
||||
return row;
|
||||
}));
|
||||
$("wear-rule-more").hidden = Boolean(animal && query && results.length > 0 && total <= results.length);
|
||||
$("wear-rule-more").textContent = !animal ? "Choose an animal, then search for clothing."
|
||||
: !query ? "Search for clothing to control for this animal."
|
||||
: results.length === 0 ? "No clothing matches."
|
||||
: `${total} clothing items match; these are the first ${results.length}. Type more of the name.`;
|
||||
const active = animal ? wearRuleEntries.filter(rule => rule.blockedTypes.includes(animal)) : [];
|
||||
$("wear-rule-active").replaceChildren(...active.map(rule => {
|
||||
const row = el("li");
|
||||
row.append(el("span", rule.name || "(no name)"), el("span", `clothing ${rule.id} · blocked for ${wearNames(rule.blockedTypes)}`, "meta"),
|
||||
button("Edit", () => chooseWearRule(rule)));
|
||||
return row;
|
||||
}));
|
||||
$("no-wear-rules").hidden = active.length > 0;
|
||||
};
|
||||
|
||||
const loadWearRules = async () => {
|
||||
const query = $("wear-rule-q").value.trim();
|
||||
const asked = ++wearRuleAsked;
|
||||
const result = await api(`items/wear-rules?q=${encodeURIComponent(query)}`);
|
||||
if (asked !== wearRuleAsked || !result.ok) {
|
||||
return;
|
||||
}
|
||||
wearAnimals = result.data.animals || [];
|
||||
$("wear-rule-animal").replaceChildren(...wearAnimals.map(animal => {
|
||||
const button = el("button", animal.name, selectedWearAnimal() === animal.id ? "primary" : "");
|
||||
button.type = "button";
|
||||
button.setAttribute("aria-pressed", String(selectedWearAnimal() === animal.id));
|
||||
button.addEventListener("click", () => chooseWearAnimal(animal.id));
|
||||
return button;
|
||||
}));
|
||||
wearRuleEntries = result.data.rules || [];
|
||||
renderWearRules(selectedWearAnimal() && query ? result.data.results || [] : [], query, result.data.total || 0);
|
||||
renderWearRuleEditor();
|
||||
};
|
||||
|
||||
$("wear-rule-q").addEventListener("input", () => {
|
||||
clearTimeout(wearRuleTimer);
|
||||
wearRuleTimer = setTimeout(loadWearRules, 250);
|
||||
});
|
||||
$("wear-rule-save").addEventListener("click", async () => {
|
||||
if (!wearSelected) {
|
||||
return;
|
||||
}
|
||||
const result = await api("items/wear-rules", {id: wearSelected.id, blockedTypes: [...wearSelectedTypes].sort((one, two) => one - two)});
|
||||
setStatus($("wear-rule-status"), said(result), !result.ok);
|
||||
if (result.ok) {
|
||||
await loadWearRules();
|
||||
}
|
||||
});
|
||||
$("wear-rule-close").addEventListener("click", () => {
|
||||
wearSelected = null;
|
||||
setStatus($("wear-rule-status"), "");
|
||||
renderWearRuleEditor();
|
||||
});
|
||||
|
||||
// ---- the overview's item lock: any item by name or id, locked or
|
||||
// unlocked where it is found (the Items page lists every locked one).
|
||||
let quickLockTimer = null;
|
||||
@@ -2717,6 +2886,9 @@
|
||||
renderSupport(result.data);
|
||||
}
|
||||
}
|
||||
else if (tab === "wear-rules") {
|
||||
await loadWearRules();
|
||||
}
|
||||
else if (tab === "items") {
|
||||
result = await api("items");
|
||||
if (result.ok) {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Burrow dashboard</title>
|
||||
<link rel="icon" type="image/png" href="/logo-square.png">
|
||||
<style>
|
||||
@font-face { font-family: DigitalDelivery; src: url("/fonts/CCDigitalDelivery-Regular.otf") format("opentype"); }
|
||||
@font-face { font-family: DigitalDelivery; font-weight: 700; src: url("/fonts/CCDigitalDelivery-Bold.otf") format("opentype"); }
|
||||
:root { color-scheme: dark; } * { box-sizing: border-box; }
|
||||
body { margin: 0; min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #000; color: #fff; font: 16px/1.45 DigitalDelivery, system-ui, sans-serif; }
|
||||
main { width: min(720px, 100%); padding: clamp(24px, 6vw, 48px); border: 1px solid #333; border-radius: 22px; background: #0d0d0d; }
|
||||
header { display: flex; align-items: center; gap: 15px; margin-bottom: 28px; } header img { width: 54px; height: 54px; object-fit: contain; } h1 { margin: 0; font-size: 30px; } p { color: #aaa; margin: 5px 0 0; }
|
||||
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; } a { display: block; padding: 20px; color: inherit; text-decoration: none; border: 1px solid #3a3a3a; border-radius: 15px; background: #151515; } a:hover, a:focus-visible { background: #222; border-color: #fff; outline: none; } strong { display: block; font-size: 19px; margin-bottom: 5px; } .hint { font-size: 13px; color: #aaa; } footer { margin-top: 24px; font-size: 12px; color: #777; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<header><img src="/logo.png" alt=""><div><h1>Burrow dashboard</h1><p>One place for running and moderating your server.</p></div></header>
|
||||
<div class="choices">
|
||||
<a href="/dashboard/admin"><strong>Owner dashboard</strong><span class="hint">Server settings, accounts, logs, items, roles, and all administration.</span></a>
|
||||
<a href="/dashboard/staff"><strong>Staff dashboard</strong><span class="hint">Player care, reports, moderation, review, and server health.</span></a>
|
||||
</div>
|
||||
<footer>Access remains role-based. Staff never receive owner controls.</footer>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
+1091
-248
File diff suppressed because it is too large.
Load diff
+2
-1
@@ -161,7 +161,7 @@
|
||||
<section>
|
||||
<h2>1. Who is responsible</h2>
|
||||
<p>The controller of your personal data is the operator of Burrow, {{operator}}. Contact for anything in this policy: {{legalEmail}}. General contact: {{adminEmail}}.</p>
|
||||
<p>We do not sell data, show ads, track you across sites or send marketing. We do not collect your real name, email address or date of birth. The only statistics we keep are the game's own activity figures in section 2, which are used only to run and plan the server, and the overall traffic figures described in section 4.</p>
|
||||
<p>We do not sell data, show ads, track you across sites or send marketing. We do not collect your real name or date of birth. We keep a recovery email address only to send one-time password and 2FA recovery links. The only statistics we keep are the game's own activity figures in section 2, which are used only to run and plan the server, and the overall traffic figures described in section 4.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
@@ -170,6 +170,7 @@
|
||||
<thead><tr><th>Data</th><th>Why</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td>Username, password (stored only as a salted hash), and the date and version of the terms you accepted</td><td>To give you an account</td></tr>
|
||||
<tr><td>Recovery email address</td><td>To verify ownership before sending a one-time password or 2FA recovery link</td></tr>
|
||||
<tr><td>Your game data: animals, items, dens, pets, buddies, block list, trades, achievements, settings</td><td>To run the game for you</td></tr>
|
||||
<tr><td>What you choose to write or make: bio, Discord username (optional), Jam-A-Grams, wall posts, paintings, feedback</td><td>To show or deliver it as you asked</td></tr>
|
||||
<tr><td>Typed chat and whispers, with the room and time, and the words of Jam-A-Grams and wall posts, with who they went to</td><td>Moderation: reviewing reports and deciding on bans</td></tr>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<!doctype html>
|
||||
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Recover account</title><link rel="icon" type="image/png" href="/logo-square.png">
|
||||
<style>@font-face{font-family:d;src:url('/fonts/CCDigitalDelivery-Regular.otf')}*{box-sizing:border-box}body{margin:0;padding:48px 16px;background:#000;color:#fff;font:16px/1.45 d,system-ui}main{max-width:420px;margin:auto;padding:28px;background:#0d0d0d;border:1px solid #2e2e2e;border-radius:18px}.logo{height:62px}h1{font-size:25px;margin:10px 0}p,label{color:#aaa}label{display:block;margin:14px 0 5px}input,select,button{width:100%;font:inherit;color:#fff;background:#000;border:1px solid #444;border-radius:12px;padding:10px 12px}button{margin-top:20px;background:#fff;color:#000;font-weight:bold;cursor:pointer}.status{min-height:24px;margin:14px 0 0;color:#aaa}a{color:#fff}</style></head>
|
||||
<body><main><img class="logo" src="/logo.png" alt=""><h1>Account recovery</h1>
|
||||
<div id="request"><p>We’ll send a one-time recovery link to the email saved on your account.</p><form id="request-form"><label>Username<input id="username" autocomplete="username" required></label><label>Recovery email<input id="email" type="email" autocomplete="email" required></label><label>What do you need to recover?<select id="kind"><option value="password">Password</option><option value="twoStep">2FA</option></select></label><button>Send recovery link</button></form></div>
|
||||
<div id="complete" hidden><p id="intro"></p><form id="complete-form"><label id="password-label">New password<input id="password" type="password" autocomplete="new-password" minlength="10"></label><button>Complete recovery</button></form></div><p class="status" id="status" role="status"></p><p><a href="/account">Back to sign in</a></p></main>
|
||||
<script>"use strict";const $=id=>document.getElementById(id),token=new URLSearchParams(location.search).get('token');const post=async(path,body)=>{const r=await fetch(path,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(body)});return {ok:r.ok,data:await r.json()}};const status=(text)=>$('status').textContent=text;if(token){post('/account/api/recover/check',{token}).then(r=>{if(!r.ok){status(r.data.error);return}$('request').hidden=true;$('complete').hidden=false;const two=r.data.kind==='twoStep';$('intro').textContent=two?'Confirm that you want to remove 2FA from this account.':'Choose a new password.';$('password-label').hidden=two;$('password').required=!two}).catch(()=>status('The server did not answer.'))}$('request-form').addEventListener('submit',async e=>{e.preventDefault();const r=await post('/account/api/recover/request',{username:$('username').value,email:$('email').value,kind:$('kind').value});status(r.data.ok||'Could not start recovery.')});$('complete-form').addEventListener('submit',async e=>{e.preventDefault();const r=await post('/account/api/recover/complete',{token,password:$('password').value});status(r.data.ok||r.data.error||'Could not complete recovery.')});</script></body></html>
|
||||
@@ -200,6 +200,8 @@
|
||||
<input id="password" name="password" type="password" autocomplete="new-password" minlength="10" maxlength="100" required>
|
||||
<label for="confirm">Password again</label>
|
||||
<input id="confirm" name="confirm" type="password" autocomplete="new-password" required>
|
||||
<label for="email">Recovery email <span class="hint">Used only to recover your password or 2FA</span></label>
|
||||
<input id="email" name="email" type="email" autocomplete="email" maxlength="254" required>
|
||||
<label class="agree"><input id="agreed" name="agreed" type="checkbox" required>
|
||||
<span>I am 13 or older, and old enough in my country to agree to this myself. I agree to the <a href="/terms" target="_blank" rel="noopener">Terms of Service</a> and the <a href="/privacy" target="_blank" rel="noopener">Privacy Policy</a>.</span></label>
|
||||
<div class="captcha" id="captcha"></div>
|
||||
@@ -242,6 +244,7 @@
|
||||
captcha_required: "Complete the captcha.",
|
||||
captcha_failed: "Captcha failed. Try again.",
|
||||
captcha_unavailable: "Captcha unavailable. Try again later.",
|
||||
invalid_email: "Enter a valid recovery email address.",
|
||||
};
|
||||
|
||||
const $ = id => document.getElementById(id);
|
||||
@@ -335,7 +338,7 @@
|
||||
const response = await fetch("/api/register", {
|
||||
method: "POST",
|
||||
headers: {"Content-Type": "application/json"},
|
||||
body: JSON.stringify({username: form.username.value, password: form.password.value, avatarType: chosen[0], agreed: form.agreed.checked,
|
||||
body: JSON.stringify({username: form.username.value, password: form.password.value, email: form.email.value, avatarType: chosen[0], agreed: form.agreed.checked,
|
||||
captcha: answer}),
|
||||
});
|
||||
check.reset();
|
||||
|
||||
+1
-1
@@ -179,7 +179,7 @@
|
||||
<h2>3. Your account</h2>
|
||||
<ul>
|
||||
<li>You are responsible for your password and for what is done with your account. Use a password you do not use anywhere else.</li>
|
||||
<li>We do not collect an email address, so we cannot send you a password reset. Turn on 2FA and keep your recovery codes.</li>
|
||||
<li>Keep your recovery email current. We use it only to send one-time password or 2FA recovery links.</li>
|
||||
<li>You can delete your account at any time on <a href="/account">your account page</a>.</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
Reference in new issue
Block a user