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
@@ -62,6 +62,7 @@ const USER_VAR_SETTINGS = 363; // the settings menu's switches, a bit each (gui.
|
||||
// the whole message left out (see account.filter below).
|
||||
const DEFAULT_FILTER = {level: 1, mode: 1, words: ""};
|
||||
const MAX_PASSWORD_LENGTH = 100;
|
||||
const EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
// parts of the game a player can switch off for their own account, each
|
||||
// enforced where the game asks for it (featureOn below).
|
||||
// the Early Member badge (lib/badges.js) goes to an account made while
|
||||
@@ -216,6 +217,9 @@ const normalize = account => {
|
||||
// what the player set on the account page (lib/manage.js).
|
||||
account.features = {...Object.fromEntries(FEATURES.map(name => [name, true])), ...account.features}; // false = switched off
|
||||
account.locked = account.locked === true; // nobody gets into the game until its owner unlocks it
|
||||
account.recoveryEmail = typeof account.recoveryEmail === "string" && EMAIL_PATTERN.test(account.recoveryEmail)
|
||||
? account.recoveryEmail.toLowerCase() : "";
|
||||
account.recoveryTokens = Array.isArray(account.recoveryTokens) ? account.recoveryTokens.filter(token => token && token.expires > now()) : [];
|
||||
account.logins = account.logins || []; // {at, via, address, ok}, newest first: lib/accounts.js recordLogin
|
||||
account.roomThemes = account.roomThemes || {}; // room -> theme, for rooms given a look of their own ("!theme here")
|
||||
account.randomTheme = account.randomTheme === true; // a theme picked afresh at every login
|
||||
@@ -249,6 +253,9 @@ const normalize = account => {
|
||||
if (account.discordId !== undefined && !/^\d{5,25}$/.test(String(account.discordId))) {
|
||||
delete account.discordId; // the linked Discord account's id
|
||||
}
|
||||
// Set only by the owner in /admin. A matching linked Discord identity may
|
||||
// use this account to open the owner dashboard (lib/discord.js).
|
||||
account.adminDashboardAccess = account.adminDashboardAccess === true;
|
||||
account.badges = Array.isArray(account.badges) ? account.badges : []; // badge ids, given in the admin panel
|
||||
account.bio = typeof account.bio === "string" ? account.bio : ""; // their own words, for the card's Bio tab
|
||||
// seconds spent in the game in all (lib/world.js counts it), and whether
|
||||
@@ -714,6 +721,7 @@ const register = (username, password, avatar = {}) => {
|
||||
activeAvatar: 1,
|
||||
// early Member, for an account made while there are no more than a hundred.
|
||||
badges: byId.size < EARLY_MEMBERS ? [EARLY_BADGE] : [],
|
||||
recoveryEmail: typeof avatar.email === "string" && EMAIL_PATTERN.test(avatar.email.trim()) ? avatar.email.trim().toLowerCase() : "",
|
||||
});
|
||||
console.log(`[accounts] registered "${logText(username)}" (id ${logText(account.id)})`);
|
||||
return {account};
|
||||
|
||||
Reference in new issue
Block a user