source: Klonkt/src/views/pages/auth-reset.ejs@ b300682

main
Last change on this file since b300682 was 9e27d64, checked in by roboburr <roboburr@…>, 3 months ago

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@…>

  • Property mode set to 100644
File size: 1.1 KB
Line 
1<div class="container auth-page">
2 <h1>Wachtwoord resetten</h1>
3
4 <% if (!token) { %>
5 <% if (error) { %><div class="alert alert-error"><%= error %></div><% } %>
6 <p class="auth-link">
7 <a href="/auth/reset-request">Vraag een nieuwe reset-link aan</a>
8 &middot;
9 <a href="/auth/login">Terug naar inloggen</a>
10 </p>
11 <% } else { %>
12 <p class="auth-tagline">Stel een nieuw wachtwoord in voor <strong><%= username %></strong>.</p>
13
14 <% if (error) { %><div class="alert alert-error"><%= error %></div><% } %>
15
16 <form method="post" action="/auth/reset/<%= token %>" class="auth-form">
17 <label>
18 <span>Nieuw wachtwoord (min 8 tekens)</span>
19 <input type="password" name="new_password" required minlength="8" autofocus autocomplete="new-password">
20 </label>
21 <label>
22 <span>Bevestig nieuw wachtwoord</span>
23 <input type="password" name="confirm" required minlength="8" autocomplete="new-password">
24 </label>
25 <button type="submit" class="btn btn-primary">Wachtwoord instellen</button>
26 </form>
27 <% } %>
28</div>
Note: See TracBrowser for help on using the repository browser.