Changeset 9e27d64 in Klonkt for src/views/pages/account.ejs


Ignore:
Timestamp:
06/14/2026 07:31:23 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
6351545
Parents:
32cc601
Message:

auth: password admin + per-instance Google for listeners (no broker)

Robin's choice: every self-hoster has their own password admin account,
and can optionally let listeners log in to comment using their OWN Google
client. No central broker (that would tie every customer site to Robin's
Google Cloud -> systemic risk on abuse).

  • Admin = username/password (bcrypt). First-time setup via /auth/register (only when there are 0 users); closed afterwards. No public registration.
  • Forgot password: /auth/reset-request -> email (if SMTP configured) with reset link; CLI break-glass npm run reset-admin always works (no email needed).
  • Change password (logged in) restored in /account.
  • Google = per-instance own credentials, OPTIONAL, listeners only -> always role member, never admin (god/admin email is rejected; google_sub mismatch too).
  • config/google.js back to direct Google OAuth; config/mailer.js new (nodemailer).
  • jose removed from deps; nodemailer added.

Security review (workflow) incorporated:

  • Reset token no longer in production logs (dev only).
  • Reset link from PUBLIC_BASE_URL instead of X-Forwarded-Host (host poisoning).
  • Reset tokens stored SHA-256-hashed in the DB.
  • Same-origin check on all state-modifying POSTs (CSRF layer on top of sameSite-lax).
  • Login always runs one bcrypt comparison (no timing enumeration).

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/views/pages/account.ejs

    r32cc601 r9e27d64  
    6565  </section>
    6666
    67   <%# ── INLOG ─────────────────────────────────────────────── %>
     67  <%# ── WACHTWOORD ────────────────────────────────────────── %>
     68  <% if (hasPassword) { %>
     69  <section class="ax-card">
     70    <div class="ax-card-title">Wachtwoord wijzigen</div>
     71    <form action="/account/password" method="post" class="ax-form">
     72      <label class="ax-field">
     73        <span>Huidig wachtwoord</span>
     74        <input type="password" name="current" required autocomplete="current-password">
     75      </label>
     76      <div class="ax-row ax-row-2">
     77        <label class="ax-field">
     78          <span>Nieuw wachtwoord <small>(min 8 tekens)</small></span>
     79          <input type="password" name="new_password" required minlength="8" autocomplete="new-password">
     80        </label>
     81        <label class="ax-field">
     82          <span>Bevestig nieuw wachtwoord</span>
     83          <input type="password" name="confirm" required minlength="8" autocomplete="new-password">
     84        </label>
     85      </div>
     86      <div class="ax-form-actions">
     87        <button type="submit" class="ax-btn ax-btn-primary">🔒 Wachtwoord wijzigen</button>
     88      </div>
     89    </form>
     90  </section>
     91  <% } else { %>
    6892  <section class="ax-card">
    6993    <div class="ax-card-title">Inloggen</div>
    7094    <p class="ax-tagline" style="margin:0">Je bent ingelogd via Google (<%= account.email %>). Er is geen apart wachtwoord.</p>
    7195  </section>
     96  <% } %>
    7297
    7398</div>
Note: See TracChangeset for help on using the changeset viewer.