source: Klonkt/src/views/pages/auth-login.ejs@ 0804d61

main
Last change on this file since 0804d61 was b919a67, checked in by roboburr <roboburr@…>, 3 months ago

auth: all Google login errors as clear explanation blocks (codes instead of bare alert)

The Google callback now redirects with ?gerr=<code> (admin/session/email/linked/
unavailable/failed) and auth-login.ejs maps each code to a clear explanation block
with icon + heading + text (admin gets the two login paths as well). Completes the
error indication consistently; free-form ?error= text remains as fallback for the
regular alert.

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

  • Property mode set to 100644
File size: 4.1 KB
Line 
1<div class="container auth-page">
2 <h1>Inloggen</h1>
3 <% if (typeof success !== 'undefined' && success) { %><div class="alert alert-success"><%= success %></div><% } %>
4 <%
5 var GMAP = {
6 admin: { icon: '🔐', title: 'Dit is een beheerders-account',
7 body: 'Je logde in met Google, maar dit e-mailadres hoort bij de beheerder van deze site. Inloggen met Google is alleen voor luisteraars/fans — beheerders gebruiken altijd hun wachtwoord (zo kan een Google-login nooit per ongeluk beheerrechten geven).',
8 list: ['<strong>Ben je de beheerder?</strong> Log hieronder in met je <strong>gebruikersnaam + wachtwoord</strong>.', '<strong>Wil je als fan inloggen?</strong> Gebruik een <strong>ander Google-account</strong> (niet je beheerdersadres).'] },
9 session: { icon: '⏱️', title: 'Login afgebroken', body: 'De Google-login is afgebroken of de sessie was verlopen. Probeer het gewoon opnieuw.' },
10 email: { icon: '✉️', title: 'Geen geverifieerd e-mailadres', body: 'Je Google-account heeft geen geverifieerd e-mailadres. Verifieer je adres bij Google, of log in met je wachtwoord.' },
11 linked: { icon: '🔗', title: 'Adres al gekoppeld', body: 'Dit e-mailadres is al aan een ander Google-account gekoppeld. Gebruik dat account, of neem contact op met de beheerder.' },
12 unavailable: { icon: '🚫', title: 'Google-login niet beschikbaar', body: 'Inloggen met Google is op deze site (nog) niet ingesteld. Log in met je gebruikersnaam en wachtwoord.' },
13 failed: { icon: '⚠️', title: 'Google-login mislukt', body: 'Er ging iets mis bij het inloggen met Google. Probeer het opnieuw.' },
14 };
15 var _g = (typeof gerr !== 'undefined' && gerr && GMAP[gerr]) ? GMAP[gerr] : null;
16 %>
17 <% if (_g) { %>
18 <div class="auth-notice">
19 <div class="auth-notice-icon"><%= _g.icon %></div>
20 <h2 class="auth-notice-title"><%= _g.title %></h2>
21 <p><%= _g.body %></p>
22 <% if (_g.list) { %><ul class="auth-notice-list"><% _g.list.forEach(function(li){ %><li><%- li %></li><% }); %></ul><% } %>
23 </div>
24 <% } else if (error) { %><div class="alert alert-error"><%= error %></div><% } %>
25
26 <form method="post" action="/auth/login" class="auth-form">
27 <% if (typeof next !== 'undefined' && next) { %>
28 <input type="hidden" name="next" value="<%= next %>">
29 <% } %>
30 <label>
31 <span>Gebruikersnaam of e-mail</span>
32 <input type="text" name="username" value="<%= username %>" required autofocus autocomplete="username">
33 </label>
34 <label>
35 <span>Wachtwoord</span>
36 <input type="password" name="password" required autocomplete="current-password">
37 </label>
38 <button type="submit" class="btn btn-primary">Inloggen</button>
39 <p class="auth-link auth-link-muted"><a href="/auth/reset-request">Wachtwoord vergeten?</a></p>
40 </form>
41
42 <% if (googleReady) { %>
43 <div class="auth-divider"><span>of als luisteraar</span></div>
44 <a class="btn btn-google" href="/auth/google<%= (typeof next !== 'undefined' && next) ? '?next=' + encodeURIComponent(next) : '' %>">
45 <svg class="g-icon" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
46 <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"/>
47 <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"/>
48 <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"/>
49 <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"/>
50 </svg>
51 <span>Inloggen met Google</span>
52 </a>
53 <% } %>
54</div>
55
56<style>
57 .auth-notice { border: 1px solid rgba(128,128,128,.28); border-radius: 14px; padding: 18px 20px; margin-bottom: 18px; background: rgba(128,128,128,.06); }
58 .auth-notice-icon { font-size: 26px; }
59 .auth-notice-title { font-size: 17px; margin: 4px 0 8px; }
60 .auth-notice p { margin: 0 0 10px; line-height: 1.55; opacity: .9; }
61 .auth-notice-list { margin: 0; padding-left: 18px; line-height: 1.6; }
62 .auth-notice-list li { margin: 4px 0; }
63</style>
Note: See TracBrowser for help on using the repository browser.