[object Object]

← back to Dandeana Hub

accept second admin basic-auth pair (admin unified pw) alongside client credential

72dd3bbd80786b1573eaa2c5fb17455baebe74af · 2026-07-22 18:18:06 -0700 · Steve Abrams

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Files touched

Diff

commit 72dd3bbd80786b1573eaa2c5fb17455baebe74af
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed Jul 22 18:18:06 2026 -0700

    accept second admin basic-auth pair (admin unified pw) alongside client credential
    
    Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---
 server.js | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/server.js b/server.js
index 008c0ec..b3bcf5a 100644
--- a/server.js
+++ b/server.js
@@ -14,6 +14,12 @@ const _rawAuth = process.env.BASIC_AUTH || 'dandeana:w3tEgaYeOPDQ';
 const _authColon = _rawAuth.indexOf(':');
 const AUTH_USER = _rawAuth.slice(0, _authColon);
 const AUTH_PASS = _rawAuth.slice(_authColon + 1);
+// Second accepted pair: Steve's unified admin credential (ADMIN_AUTH="user:pass" overrides).
+// The client pair above must keep working — never collapse these into one.
+const _rawAdmin = process.env.ADMIN_AUTH || 'admin:DW2024!';
+const _admColon = _rawAdmin.indexOf(':');
+const ADMIN_USER = _rawAdmin.slice(0, _admColon);
+const ADMIN_PASS = _rawAdmin.slice(_admColon + 1);
 
 const app = express();
 app.disable('x-powered-by');
@@ -28,6 +34,7 @@ app.use((req, res, next) => {
     const ci = decoded.indexOf(':');
     const u = decoded.slice(0, ci), p = decoded.slice(ci + 1);
     if (u === AUTH_USER && p === AUTH_PASS) return next();
+    if (u === ADMIN_USER && p === ADMIN_PASS) return next();
   }
   res.set('WWW-Authenticate', 'Basic realm="Dandeana Private Hub"');
   return res.status(401).send('Authentication required');

← 0834584 chore: lint, refactor, v1.0.1 (session close)  ·  back to Dandeana Hub  ·  (newest)