mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 09:37:50 -05:00
feat(admin): a temporary password for a player who lost access
The account view's Lost access box gives the account a new random password (12 characters, none that look alike), shown once with a Copy button. It signs them out everywhere and forgets trusted devices; "Turn off their 2FA too" is for a lost authenticator. Written to the mod log, without the password. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
a860a67626
commit
0f367c55b8
2 files changed
+53
-1
No files matched your search
+25
-1
@@ -502,6 +502,15 @@
|
||||
<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>Lost access</h3>
|
||||
<p class="hint">A new random password, shown once. They are signed out everywhere and should change it on their account page.</p>
|
||||
<div class="row"><label class="check"><input type="checkbox" id="temp-two-step-off"> Turn off their 2FA too</label></div>
|
||||
<div class="row" style="margin-top:8px"><button type="button" data-action="tempPassword">Make temporary password</button></div>
|
||||
<div class="row" style="margin-top:8px" id="temp-password-row" hidden>
|
||||
<input id="temp-password" readonly aria-label="Temporary password" spellcheck="false" style="font-family:monospace">
|
||||
<button type="button" id="temp-password-copy">Copy</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">
|
||||
@@ -1529,6 +1538,7 @@
|
||||
label.append(box, ` ${badge.label}`);
|
||||
return label;
|
||||
}));
|
||||
$("temp-two-step-off").disabled = !current || !current.twoStep;
|
||||
$("guide-toggle").textContent = current && current.guide ? "Remove guide" : "Make guide";
|
||||
$("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";
|
||||
@@ -1566,7 +1576,8 @@
|
||||
selected = username;
|
||||
current = null;
|
||||
setStatus($("detail-status"), "");
|
||||
for (const id of ["new-name", "ban-hours", "silence-hours", "message-text", "gems-amount", "gift-value", "gift-text"]) {
|
||||
$("temp-password-row").hidden = true;
|
||||
for (const id of ["temp-password", "new-name", "ban-hours", "silence-hours", "message-text", "gems-amount", "gift-value", "gift-text"]) {
|
||||
$(id).value = "";
|
||||
}
|
||||
hashArg = username;
|
||||
@@ -1720,6 +1731,7 @@
|
||||
case "permissions": return permissionChoices();
|
||||
case "adminDashboardAccess": return {on: !(current || {}).adminDashboardAccess};
|
||||
case "guide": return {on: !(current || {}).guide};
|
||||
case "tempPassword": return {twoStepOff: $("temp-two-step-off").checked};
|
||||
case "message": return {text: $("message-text").value};
|
||||
case "gems": return {amount: numberFrom("gems-amount")};
|
||||
case "gift": return giftBody();
|
||||
@@ -1731,6 +1743,10 @@
|
||||
}
|
||||
};
|
||||
|
||||
$("temp-password-copy").addEventListener("click", () => {
|
||||
navigator.clipboard.writeText($("temp-password").value).catch(() => $("temp-password").select());
|
||||
});
|
||||
|
||||
// the "N ago" buttons fill the last-seen box and press Set.
|
||||
$("detail").addEventListener("click", event => {
|
||||
const quick = event.target.closest("button[data-ago]");
|
||||
@@ -1760,6 +1776,9 @@
|
||||
if (action === "banDevices" && !window.confirm(`Hardware ban ${selected}? Everyone on their hardware is put out.`)) {
|
||||
return;
|
||||
}
|
||||
if (action === "tempPassword" && !window.confirm(`Give ${selected} a new random password? Their old one stops working and they are signed out everywhere.`)) {
|
||||
return;
|
||||
}
|
||||
button.disabled = true;
|
||||
const result = await api("account", {username: selected, action, ...actionBody(action)});
|
||||
button.disabled = false;
|
||||
@@ -1767,6 +1786,11 @@
|
||||
if (result.ok && action === "delete") {
|
||||
selected = null;
|
||||
}
|
||||
if (result.ok && action === "tempPassword") {
|
||||
$("temp-password").value = result.data.password;
|
||||
$("temp-password-row").hidden = false;
|
||||
$("temp-two-step-off").checked = false;
|
||||
}
|
||||
if (result.ok && action === "rename") {
|
||||
selected = result.data.username;
|
||||
$("new-name").value = "";
|
||||
|
||||
Reference in new issue
Block a user