Changeset 9e27d64 in Klonkt for src/views/pages/auth-reset.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/auth-reset.ejs

    r32cc601 r9e27d64  
    11<div class="container auth-page">
    2   <h1>Reset password</h1>
     2  <h1>Wachtwoord resetten</h1>
    33
    44  <% if (!token) { %>
    55    <% if (error) { %><div class="alert alert-error"><%= error %></div><% } %>
    66    <p class="auth-link">
    7       <a href="/auth/reset-request">Request a new reset link</a>
     7      <a href="/auth/reset-request">Vraag een nieuwe reset-link aan</a>
    88      &middot;
    9       <a href="/auth/login">Back to login</a>
     9      <a href="/auth/login">Terug naar inloggen</a>
    1010    </p>
    1111  <% } else { %>
    12     <p class="auth-tagline">Set a new password for <strong><%= username %></strong>.</p>
     12    <p class="auth-tagline">Stel een nieuw wachtwoord in voor <strong><%= username %></strong>.</p>
    1313
    1414    <% if (error) { %><div class="alert alert-error"><%= error %></div><% } %>
     
    1616    <form method="post" action="/auth/reset/<%= token %>" class="auth-form">
    1717      <label>
    18         <span>New password (min 8 chars)</span>
     18        <span>Nieuw wachtwoord (min 8 tekens)</span>
    1919        <input type="password" name="new_password" required minlength="8" autofocus autocomplete="new-password">
    2020      </label>
    2121      <label>
    22         <span>Confirm new password</span>
     22        <span>Bevestig nieuw wachtwoord</span>
    2323        <input type="password" name="confirm" required minlength="8" autocomplete="new-password">
    2424      </label>
    25       <button type="submit" class="btn btn-primary">Set password</button>
     25      <button type="submit" class="btn btn-primary">Wachtwoord instellen</button>
    2626    </form>
    2727  <% } %>
Note: See TracChangeset for help on using the changeset viewer.