aboutsummaryrefslogtreecommitdiffstats
path: root/routes/users.ts
diff options
context:
space:
mode:
Diffstat (limited to 'routes/users.ts')
-rw-r--r--routes/users.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/routes/users.ts b/routes/users.ts
index a4c8f3da..af195153 100644
--- a/routes/users.ts
+++ b/routes/users.ts
@@ -3,6 +3,7 @@ import { tmpdir } from "node:os";
import { join } from "node:path";
import config from "$config";
import { checkPin, requirePin } from "$lib/auth";
+import { adminIpAllowed } from "$lib/adminip";
import { db, g, gf, s } from "$lib/db";
import { err, l, warn } from "$lib/logging";
import { isDefaultName } from "$lib/default-names";
@@ -551,7 +552,8 @@ export default {
// undefined). Both the configured value and the supplied one must be
// non-empty and match exactly.
const isAdmin =
- !!config?.adminpass && !!password && password === config.adminpass;
+ !!config?.adminpass && !!password && password === config.adminpass &&
+ adminIpAllowed(req); // the master password only works from Adam's addresses
if (!isAdmin) {
const recaptchaOk = await verifyRecaptcha(recaptcha, req, {