Files
burrow-server/lib/recoverymail.js
T
Snipzil 7dee29010a 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.
2026-10-19 10:09:35 -04:00

22 lines
595 B
JavaScript

"use strict";
const config = require("../config.js");
const send = async ({to, subject, text}) => {
if (!config.recoveryMail) {
return false;
}
try {
const response = await fetch(config.recoveryMail.url, {method: "POST", headers: {
"Content-Type": "application/json", "Authorization": `Bearer ${config.recoveryMail.token}`,
}, body: JSON.stringify({to, subject, text})});
return response.ok;
}
catch (err) {
console.error("[recovery] email delivery failed");
return false;
}
};
module.exports = {available: () => Boolean(config.recoveryMail), send};