source: Klonkt/src/views/pages/auth-reset-request.ejs@ 8e29f77

main
Last change on this file since 8e29f77 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.7 KB
Line 
1<div class="container auth-page">
2 <h1>Wachtwoord resetten</h1>
3
4 <% if (sent) { %>
5 <div class="alert alert-success">
6 Als er een account bestaat voor dat e-mailadres, is er een reset-link verstuurd.
7 </div>
8 <% if (devResetUrl) { %>
9 <div class="alert alert-info">
10 <strong>Geen e-mailserver ingesteld</strong> — reset-link hieronder.
11 <p style="margin: 0.5rem 0 0; word-break: break-all;">
12 <a href="<%= devResetUrl %>"><%= devResetUrl %></a>
13 </p>
14 </div>
15 <% } %>
16 <% if (typeof mailer !== 'undefined' && !mailer) { %>
17 <p class="auth-link-muted">Geen e-mail ingesteld? De beheerder kan ook <code>npm run reset-admin</code> draaien op de server.</p>
18 <% } %>
19 <p class="auth-link"><a href="/auth/login">&larr; Terug naar inloggen</a></p>
20 <% } else { %>
21 <p class="auth-tagline">Vul je e-mail in; we sturen een reset-link.</p>
22
23 <% if (error) { %><div class="alert alert-error"><%= error %></div><% } %>
24
25 <form method="post" action="/auth/reset-request" class="auth-form">
26 <label>
27 <span>E-mail</span>
28 <input type="email" name="email" required autofocus autocomplete="email">
29 </label>
30 <button type="submit" class="btn btn-primary">Stuur reset-link</button>
31 <p class="auth-link"><a href="/auth/login">&larr; Terug naar inloggen</a></p>
32 </form>
33 <% } %>
34</div>
35
36<style>
37.auth-tagline { text-align: center; color: var(--ink-muted, var(--ink-soft)); margin-bottom: 1.5rem; }
38.alert-info { background: var(--paper-2); color: var(--ink); border: 1px solid var(--accent); border-radius: 5px; padding: 0.75rem 1rem; margin-bottom: 1rem; }
39.auth-link-muted { font-size: 0.85rem; color: var(--ink-muted, var(--ink-soft)); }
40</style>
Note: See TracBrowser for help on using the repository browser.