source: Klonkt/src/views/pages/account.ejs@ e7f6691

main
Last change on this file since e7f6691 was 075185a, checked in by Robin Genis <roboburr@…>, 3 months ago

refactor(auth): remove Google login (listeners now interact via the fediverse)

Removes config/google.js, the /auth/google* routes, the admin Google config page
+ links, the account link/unlink, and the public Google login button. /login and
/auth/admin both show the admin password form. SEO/Search-Console Google is
untouched. (Native comments removed next.)

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

  • Property mode set to 100644
File size: 15.3 KB
RevLine 
[7bc636b]1<div class="container ax-page">
2
3 <header class="ax-header">
[4885eab]4 <a href="/" class="ax-back" aria-label="<%= t('acct.back_home') %>">←</a>
[7bc636b]5 <div>
[4885eab]6 <h1><%= t('acct.title') %></h1>
7 <p class="ax-tagline"><%= t('acct.subtitle') %></p>
[7bc636b]8 </div>
9 </header>
10
11 <% if (success) { %><div class="ax-flash ax-flash-ok"><%= success %></div><% } %>
12 <% if (error) { %><div class="ax-flash ax-flash-err"><%= error %></div><% } %>
13
[8afbdd6]14 <% if (isViewer) { %>
15 <div class="ax-viewer-note" role="note">
16 <span class="ax-viewer-ico" aria-hidden="true">👁️</span>
17 <div>
[4885eab]18 <strong><%= t('acct.viewer_mode') %></strong>
19 <span><%= t('acct.viewer_note') %></span>
[8afbdd6]20 </div>
21 </div>
22 <% } %>
23
[7bc636b]24 <%# ── PROFILE ────────────────────────────────────────────── %>
25 <section class="ax-card">
[4885eab]26 <div class="ax-card-title"><%= t('acct.profile') %></div>
[7bc636b]27
28 <div class="ax-profile-id">
[8afbdd6]29 <% if (canMutate) { %>
30 <form action="/account/avatar" method="post" enctype="multipart/form-data" class="ax-avatar-form">
[4885eab]31 <label class="ax-avatar-wrap" title="<%= t('acct.avatar_change') %>">
[8afbdd6]32 <span class="ax-profile-avatar">
[82079ad]33 <% var _av = account.avatar_url || (typeof siteAvatar !== 'undefined' ? siteAvatar : null); %>
34 <% if (_av) { %>
35 <img src="<%= _av %>" alt="">
[8afbdd6]36 <% } else { %>
37 <span><%= account.username.charAt(0).toUpperCase() %></span>
38 <% } %>
39 </span>
40 <span class="ax-avatar-edit" aria-hidden="true">
41 <svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg>
42 </span>
43 <input type="file" name="avatar" accept="image/jpeg,image/png,image/webp,image/gif" onchange="this.form.submit()" hidden>
44 </label>
45 </form>
46 <% } else { %>
47 <span class="ax-profile-avatar ax-profile-avatar-static">
[82079ad]48 <% var _av2 = account.avatar_url || (typeof siteAvatar !== 'undefined' ? siteAvatar : null); %>
49 <% if (_av2) { %>
50 <img src="<%= _av2 %>" alt="">
[8afbdd6]51 <% } else { %>
52 <span><%= account.username.charAt(0).toUpperCase() %></span>
53 <% } %>
54 </span>
55 <% } %>
[7bc636b]56 <div class="ax-profile-meta">
57 <div class="ax-profile-name"><%= account.username %></div>
58 <div class="ax-profile-role"><%= account.role %> · <%= account.email %></div>
59 <% if (account.created_at) { %>
[4885eab]60 <div class="ax-profile-joined"><%= t('acct.member_since') %> <%= formatDate(account.created_at) %></div>
[7bc636b]61 <% } %>
[8afbdd6]62 <% if (account.avatar_url && canMutate) { %>
[6150acb]63 <form action="/account/avatar/remove" method="post" class="ax-avatar-remove">
[4885eab]64 <button type="submit" class="ax-linkbtn"><%= t('acct.avatar_remove') %></button>
[6150acb]65 </form>
[7bc636b]66 <% } %>
67 </div>
[6150acb]68 </div>
[7bc636b]69
[8afbdd6]70 <% if (canMutate) { %>
71 <form action="/account/profile" method="post" class="ax-form ax-form-bio">
[7c44c12]72 <label class="ax-field">
73 <span><%= t('acct.username') %></span>
74 <input type="text" name="username" value="<%= account.username %>" minlength="2" maxlength="30" pattern="[A-Za-z0-9_\-]{2,30}" autocomplete="username">
75 </label>
[6d882b1]76 <label class="ax-field">
[4885eab]77 <span><%= t('acct.email') %></span>
78 <input type="email" name="email" value="<%= account.email || '' %>" maxlength="254" autocomplete="email" placeholder="<%= t('acct.email_ph') %>">
[6d882b1]79 </label>
[8afbdd6]80 <label class="ax-field">
[4885eab]81 <span><%= t('acct.bio') %></span>
82 <textarea name="bio" rows="3" maxlength="500" placeholder="<%= t('acct.bio_ph') %>"><%= account.bio || '' %></textarea>
[8afbdd6]83 </label>
84 <div class="ax-form-actions">
[4885eab]85 <button type="submit" class="ax-btn ax-btn-primary"><%= t('acct.save') %></button>
[8afbdd6]86 </div>
87 </form>
88 <% } else { %>
89 <div class="ax-form ax-form-bio">
90 <label class="ax-field">
[4885eab]91 <span><%= t('acct.bio') %></span>
92 <textarea rows="3" disabled placeholder="<%= t('acct.bio_empty') %>"><%= account.bio || '' %></textarea>
[8afbdd6]93 </label>
[7bc636b]94 </div>
[8afbdd6]95 <% } %>
[7bc636b]96 </section>
97
[834bcc3]98 <%# ── PERSONAL LANGUAGE ──────────────────────────────────── %>
[5e61b17]99 <% if (canMutate) { %>
100 <section class="ax-card">
101 <div class="ax-card-title"><%= t('acct.lang_label') %></div>
102 <form action="/account/lang" method="post" class="ax-form">
103 <label class="ax-field">
104 <span><%= t('acct.lang_label') %> <small><%= t('acct.lang_hint') %></small></span>
105 <select name="lang">
106 <% langs.forEach(function(l){ var sel = (account && account.lang) ? (account.lang === l.code) : l.active; %>
107 <option value="<%= l.code %>"<%= sel ? ' selected' : '' %>><%= l.name %></option>
108 <% }); %>
109 </select>
110 </label>
111 <div class="ax-form-actions">
112 <button type="submit" class="ax-btn ax-btn-primary"><%= t('acct.save') %></button>
113 </div>
114 </form>
115 </section>
116 <% } %>
117
[834bcc3]118 <%# ── SITE (owner may update their site name) ─────────── %>
[1be21ba]119 <% if (typeof editableSite !== 'undefined' && editableSite && canMutate) { %>
120 <section class="ax-card">
[4885eab]121 <div class="ax-card-title"><%= t('acct.site') %></div>
[1be21ba]122 <form action="/account/site" method="post" class="ax-form">
123 <label class="ax-field">
[4885eab]124 <span><%= t('acct.site_name') %> <small><%= t('acct.site_name_hint') %></small></span>
[1be21ba]125 <input type="text" name="site_title" value="<%= editableSite.title || '' %>" maxlength="200" required>
126 </label>
127 <label class="ax-field">
[4885eab]128 <span><%= t('acct.tagline') %> <small><%= t('acct.tagline_hint') %></small></span>
[1be21ba]129 <input type="text" name="site_tagline" value="<%= editableSite.tagline || '' %>" maxlength="200">
130 </label>
131 <div class="ax-form-actions">
[4885eab]132 <button type="submit" class="ax-btn ax-btn-primary"><%= t('acct.site_save') %></button>
[1be21ba]133 </div>
134 </form>
135 </section>
136 <% } %>
137
[834bcc3]138 <%# ── PASSWORD ──────────────────────────────────────────── %>
139 <%# In viewer mode there is no password section (nothing to change). %>
[8afbdd6]140 <% if (canMutate) { %>
[9e27d64]141 <% if (hasPassword) { %>
142 <section class="ax-card">
[4885eab]143 <div class="ax-card-title"><%= t('acct.password_change') %></div>
[9e27d64]144 <form action="/account/password" method="post" class="ax-form">
145 <label class="ax-field">
[4885eab]146 <span><%= t('acct.password_current') %></span>
[9e27d64]147 <input type="password" name="current" required autocomplete="current-password">
148 </label>
149 <div class="ax-row ax-row-2">
150 <label class="ax-field">
[4885eab]151 <span><%= t('acct.password_new') %> <small><%= t('acct.password_min') %></small></span>
[9e27d64]152 <input type="password" name="new_password" required minlength="8" autocomplete="new-password">
153 </label>
154 <label class="ax-field">
[4885eab]155 <span><%= t('acct.password_confirm') %></span>
[9e27d64]156 <input type="password" name="confirm" required minlength="8" autocomplete="new-password">
157 </label>
158 </div>
159 <div class="ax-form-actions">
[4885eab]160 <button type="submit" class="ax-btn ax-btn-primary"><%= t('acct.password_change') %></button>
[9e27d64]161 </div>
162 </form>
163 </section>
[247988e]164
[9e27d64]165 <% } else { %>
[7bc636b]166 <section class="ax-card">
[4885eab]167 <div class="ax-card-title"><%= t('acct.login') %></div>
168 <p class="ax-tagline" style="margin:0"><%= t('acct.login_google_only', { email: account.email }) %></p>
[7bc636b]169 </section>
[9e27d64]170 <% } %>
[8afbdd6]171 <% } %>
[7bc636b]172
173</div>
174
175<style>
176.ax-page { max-width: 720px; margin: 1.5rem auto 4rem; padding: 0 1rem; }
177.ax-header { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 1.5rem; }
178.ax-header h1 { font-family: var(--font-display, serif); font-size: 1.75rem; margin: 0 0 0.25rem; }
179.ax-tagline { color: var(--ink-muted, var(--ink-soft)); margin: 0; font-size: 0.9rem; }
180.ax-back {
181 display: inline-flex; align-items: center; justify-content: center;
182 width: 40px; height: 40px;
183 border: 1px solid var(--rule); border-radius: 8px;
184 background: var(--paper); color: var(--ink); text-decoration: none;
185 font-size: 1.1rem; flex-shrink: 0; transition: border-color 120ms;
186}
187.ax-back:hover { border-color: var(--accent); }
188
189.ax-flash { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
190.ax-flash-ok { background: rgba(40,160,90,.15); color: #2a9d5e; border: 1px solid rgba(40,160,90,.3); }
191.ax-flash-err { background: rgba(200,60,60,.15); color: #c33; border: 1px solid rgba(200,60,60,.3); }
192
[8afbdd6]193/* ─── Kijker-modus notice ──────────────────────────────────────── */
194.ax-viewer-note {
195 display: flex; align-items: flex-start; gap: 0.75rem;
196 padding: 0.85rem 1rem; margin-bottom: 1rem;
197 border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--rule));
198 border-left: 3px solid var(--accent);
199 border-radius: 10px;
200 background: color-mix(in srgb, var(--accent) 8%, var(--paper));
201}
202.ax-viewer-ico { font-size: 1.1rem; line-height: 1.4; }
203.ax-viewer-note strong { display: block; font-size: 0.92rem; }
204.ax-viewer-note span { color: var(--ink-muted, var(--ink-soft)); font-size: 0.85rem; }
205.ax-profile-avatar-static { flex-shrink: 0; }
206.ax-form-bio textarea:disabled { opacity: 0.7; cursor: default; }
207
[7bc636b]208/* ─── Cards ────────────────────────────────────────────────────── */
209.ax-card {
210 background: var(--paper);
211 border: 1px solid var(--rule);
212 border-radius: 12px;
213 padding: 1.25rem;
214 margin-bottom: 1rem;
215}
216.ax-card-title {
217 font-family: var(--font-display, serif);
218 font-size: 1.15rem;
219 font-weight: 600;
220 margin-bottom: 1rem;
221}
222
223/* ─── Form fields ──────────────────────────────────────────────── */
224.ax-form { display: flex; flex-direction: column; gap: 0.85rem; }
225.ax-form-bio { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
226.ax-row { display: grid; gap: 0.85rem; }
227.ax-row-2 { grid-template-columns: 1fr 1fr; }
228@media (max-width: 600px) { .ax-row-2 { grid-template-columns: 1fr; } }
229
230.ax-field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
231.ax-field > span {
232 font-size: 0.8rem; font-weight: 600;
233 color: var(--ink-soft);
234 display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap;
235}
236.ax-field > span small { font-weight: 400; color: var(--ink-muted); font-size: 0.95em; }
237.ax-field input[type="text"],
238.ax-field input[type="email"],
239.ax-field input[type="password"],
240.ax-field input[type="url"],
241.ax-field select,
242.ax-field textarea {
243 width: 100%;
244 box-sizing: border-box;
245 padding: 0.6rem 0.75rem;
246 border: 1px solid var(--rule);
247 border-radius: 6px;
248 background: var(--paper-2);
249 color: var(--ink);
250 font-family: var(--font-ui, system-ui), sans-serif;
251 font-size: 0.95rem;
252 -webkit-appearance: none; appearance: none;
253 transition: border-color 120ms;
254}
255.ax-field textarea { resize: vertical; min-height: 70px; font-family: inherit; }
256.ax-field input:focus, .ax-field select:focus, .ax-field textarea:focus {
257 outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent);
258}
259
260/* ─── File upload ─────────────────────────────────────────────── */
261.ax-file-control {
262 display: flex; align-items: center; gap: 0.5rem;
263 flex-wrap: wrap;
264 position: relative;
265 min-height: 40px;
266}
267.ax-file-control input[type="file"] {
268 position: absolute; inset: 0;
269 opacity: 0; cursor: pointer;
270 z-index: 2;
271}
272.ax-file-btn { pointer-events: none; }
273.ax-file-name {
274 font-size: 0.85rem;
275 color: var(--ink);
276 word-break: break-all;
277 flex: 1; min-width: 0;
278}
279.ax-file-name[data-empty] { color: var(--ink-muted, var(--ink-soft)); }
280
281.ax-form-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.25rem; }
282
283/* ─── Buttons ──────────────────────────────────────────────────── */
284.ax-btn {
285 display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
286 padding: 0.55rem 1rem;
287 border: 1px solid var(--rule); background: var(--paper-2);
288 color: var(--ink);
289 font-family: var(--font-ui, system-ui), sans-serif;
290 font-size: 0.9rem; font-weight: 500;
291 text-decoration: none; border-radius: 6px;
292 cursor: pointer; min-height: 40px;
293 transition: background 120ms, border-color 120ms;
294 -webkit-tap-highlight-color: transparent;
295}
296.ax-btn:hover { border-color: var(--accent); }
297.ax-btn-secondary { background: var(--paper-2); }
[6fcd0cf]298.ax-btn-primary, a.ax-btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
299.ax-btn-primary:hover, a.ax-btn-primary:hover { opacity: 0.92; border-color: var(--accent); color: #fff; }
[7bc636b]300
301/* ─── Profile ID row ──────────────────────────────────────────── */
302.ax-profile-id {
303 display: flex; align-items: center; gap: 1rem;
304 padding-bottom: 1rem;
305 border-bottom: 1px solid var(--rule);
306 margin-bottom: 1rem;
307}
[6150acb]308.ax-avatar-form { margin: 0; flex-shrink: 0; }
309.ax-avatar-wrap {
310 position: relative; display: block;
311 width: 84px; height: 84px; cursor: pointer;
312}
[7bc636b]313.ax-profile-avatar {
[6150acb]314 width: 84px; height: 84px;
[7bc636b]315 border-radius: 50%;
316 overflow: hidden;
317 background: var(--paper-2); /* neutral so transparent avatars blend */
318 color: var(--accent); /* accent only for the fallback initial */
319 display: inline-flex; align-items: center; justify-content: center;
320 font-family: var(--font-display, serif);
[6150acb]321 font-size: 1.7rem; font-weight: 600;
322 border: 1px solid var(--rule);
323 transition: border-color 120ms;
[7bc636b]324}
[6150acb]325.ax-avatar-wrap:hover .ax-profile-avatar { border-color: var(--accent); }
[7bc636b]326.ax-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
[6150acb]327.ax-avatar-edit {
328 position: absolute; right: -2px; bottom: -2px;
329 width: 28px; height: 28px; border-radius: 50%;
330 background: var(--accent); color: #fff;
331 display: flex; align-items: center; justify-content: center;
332 border: 3px solid var(--paper);
333 transition: transform 120ms;
334}
335.ax-avatar-wrap:hover .ax-avatar-edit { transform: scale(1.08); }
336.ax-avatar-remove { margin-top: 0.45rem; }
337.ax-linkbtn {
338 background: none; border: 0; padding: 0; cursor: pointer;
339 color: var(--ink-muted, var(--ink-soft)); font-size: 0.8rem; text-decoration: underline;
340 font-family: var(--font-ui, system-ui), sans-serif;
341}
342.ax-linkbtn:hover { color: #c33; }
[7bc636b]343.ax-profile-meta { min-width: 0; }
344.ax-profile-name { font-weight: 600; font-size: 1.1rem; }
345.ax-profile-role,
346.ax-profile-joined {
347 color: var(--ink-muted, var(--ink-soft));
348 font-size: 0.85rem;
349}
350
351@media (max-width: 480px) {
352 .ax-profile-id { flex-direction: column; align-items: flex-start; gap: 0.75rem; text-align: left; }
353}
354</style>
Note: See TracBrowser for help on using the repository browser.