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:
Snipzil committed 2026-10-19 10:09:35 -04:00
1 parent 4997315239
commit 7dee29010a
27 files changed
+2303 -346

No files matched your search

+5 -2
View File
@@ -257,7 +257,10 @@ const handle = async (route, params, body, from) => {
if (device && devices.banOf(device)) {
return {status: 403, body: {error: "device_banned"}};
}
const {username, password, avatarType} = body || {};
const {username, password, avatarType, email} = body || {};
if (config.recoveryMail && (typeof email !== "string" || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email.trim()))) {
return {status: 400, body: {error: "invalid_email"}};
}
// the terms and the privacy policy, and old enough to agree to them:
// said by the one signing up, on the page or in the client.
if ((body || {}).agreed !== true) {
@@ -279,7 +282,7 @@ const handle = async (route, params, body, from) => {
if (!STARTER_ANIMALS.includes(avatarType)) {
return {status: 400, body: {error: "choose_animal"}};
}
const result = accounts.register(username, password, {type: avatarType});
const result = accounts.register(username, password, {type: avatarType, email});
if (result.account) {
result.account.agreed = {version: config.termsVersion, at: Math.floor(Date.now() / 1000)};
accounts.save(result.account);