source: Klonkt/src/views/pages/auth-login.ejs@ 32cc601

main
Last change on this file since 32cc601 was c80e78b, checked in by roboburr <roboburr@…>, 3 months ago

auth: replace username/password with Google login

Listeners (and the owner) now log in via Google instead of a local
username/password account. This lowers the barrier to commenting and
removes the home-built password/registration system.

  • src/config/google.js: raw OAuth2 helpers (authorize/token/userinfo) via the built-in fetch, config-driven. Boot keeps working without credentials.
  • src/routes/auth.js: /auth/google + /auth/google/callback (find-or-create user on email, ADMIN_EMAIL -> god, set session). login/register/reset POST handlers removed; /login now shows the Google button.
  • database.js: idempotent column users.google_sub.
  • account.js + account.ejs: change-password removed.
  • auth-login.ejs / welcome.ejs: Google button instead of password form.
  • shared-styles.ejs: .btn-google styling.
  • .env.example: GOOGLE_CLIENT_ID/SECRET/REDIRECT_URI + ADMIN_EMAIL.

Existing users are matched on email (owner retains their site).
DO NOT deploy to roboburr until the Google credentials are in .env, otherwise
the owner locks themselves out.

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

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[7bc636b]1<div class="container auth-page">
[c80e78b]2 <h1>Inloggen</h1>
[7bc636b]3 <% if (error) { %><div class="alert alert-error"><%= error %></div><% } %>
[c80e78b]4
5 <div class="auth-form auth-google">
6 <% if (googleReady) { %>
7 <p class="auth-intro">Log in met je Google-account om mee te praten.</p>
8 <a class="btn btn-google" href="/auth/google<%= (typeof next !== 'undefined' && next) ? '?next=' + encodeURIComponent(next) : '' %>">
9 <svg class="g-icon" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
10 <path fill="#4285F4" d="M17.64 9.2c0-.64-.06-1.25-.16-1.84H9v3.48h4.84a4.14 4.14 0 0 1-1.8 2.72v2.26h2.92c1.7-1.57 2.68-3.88 2.68-6.62z"/>
11 <path fill="#34A853" d="M9 18c2.43 0 4.47-.8 5.96-2.18l-2.92-2.26c-.8.54-1.84.86-3.04.86-2.34 0-4.32-1.58-5.03-3.7H.96v2.33A9 9 0 0 0 9 18z"/>
12 <path fill="#FBBC05" d="M3.97 10.72a5.4 5.4 0 0 1 0-3.44V4.95H.96a9 9 0 0 0 0 8.1l3.01-2.33z"/>
13 <path fill="#EA4335" d="M9 3.58c1.32 0 2.5.45 3.44 1.35l2.58-2.58A9 9 0 0 0 .96 4.95l3.01 2.33C4.68 5.16 6.66 3.58 9 3.58z"/>
14 </svg>
15 <span>Inloggen met Google</span>
16 </a>
17 <% } else { %>
18 <p class="auth-intro">Inloggen via Google is op deze site nog niet ingesteld.</p>
[7bc636b]19 <% } %>
[c80e78b]20 </div>
[7bc636b]21</div>
Note: See TracBrowser for help on using the repository browser.