adds configurable PoW timeout and iteration count

This commit is contained in:
nai-degen
2024-05-21 12:38:41 -05:00
parent 63ab1a7685
commit b76db652e0
10 changed files with 228 additions and 84 deletions
+3
View File
@@ -17,6 +17,7 @@ import {
} from "../../shared/users/schema";
import { getLastNImages } from "../../shared/file-storage/image-history";
import { blacklists, parseCidrs, whitelists } from "../../shared/cidr";
import { invalidatePowHmacKey } from "../../user/web/pow-captcha";
const router = Router();
@@ -313,8 +314,10 @@ router.post("/maintenance", (req, res) => {
const temps = users.filter((u) => u.type === "temporary");
temps.forEach((user) => {
user.expiresAt = Date.now();
user.disabledReason = "Admin forced expiration."
userStore.upsertUser(user);
});
invalidatePowHmacKey()
flash.type = "success";
flash.message = `${temps.length} temporary users marked for expiration.`;
break;
+2 -3
View File
@@ -12,13 +12,12 @@
}
#token-manage {
width: 100%;
display: flex;
width: 100%;
}
#token-manage button {
padding: 0.5em;
margin: 0 0.5em;
flex-grow: 1;
margin: 0 0.5em;
}
</style>
+2 -3
View File
@@ -51,9 +51,8 @@
<legend>Temporary User Options</legend>
<div class="temporary-user-fieldset">
<p class="full-width">
Temporary users will be disabled after the specified duration, and their records will be deleted 72 hours after that.
These options apply only to new
temporary users; existing ones use whatever options were in effect when they were created.
Temporary users will be disabled after the specified duration, and their records will be permanently deleted after some time.
These options apply only to new temporary users; existing ones use whatever options were in effect when they were created.
</p>
<label for="temporaryUserDuration" class="full-width">Access duration (in minutes)</label>
<input type="number" name="temporaryUserDuration" id="temporaryUserDuration" value="60" class="full-width" />
+1 -1
View File
@@ -32,7 +32,7 @@
<form id="maintenanceForm" action="/admin/manage/maintenance" method="post">
<input id="_csrf" type="hidden" name="_csrf" value="<%= csrfToken %>" />
<input id="hiddenAction" type="hidden" name="action" value="" />
<div display="flex" flex-direction="column">
<div>
<fieldset>
<legend>Key Recheck</legend>
<button id="recheck-keys" type="button" onclick="submitForm('recheck')">Force Key Recheck</button>