Changeset 075185a in Klonkt for src/routes/account.js


Ignore:
Timestamp:
06/24/2026 02:16:57 PM (3 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
2e9773f
Parents:
5b47619
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/account.js

    r5b47619 r075185a  
    2424import { renderPage } from '../middleware/render.js';
    2525import { requireAuth } from '../middleware/auth.js';
    26 import { googleConfigured } from '../config/google.js';
    2726import { toWebp } from '../services/ImageWebpService.js';
    2827import { SUPPORTED } from '../services/i18n.js';
     
    6564  `).get(req.session.user.id);
    6665  const hasPassword = !!(account && account.password_hash && account.password_hash !== '!google-oauth');
    67   const googleLinked = !!(account && account.google_sub);
    6866  if (account) { delete account.password_hash; delete account.google_sub; } // don't leak to the view
    6967
     
    7472    account,
    7573    hasPassword,
    76     googleLinked,
    77     googleAvailable: googleConfigured(),
    7874    editableSite,
    7975    // Display fallback: when you have no own account avatar, show your site's photo.
     
    204200});
    205201
    206 // Unlink Google account. Only allowed if a password is set,
    207 // otherwise the user would lock themselves out (no login method left).
    208 router.post('/google/unlink', requireAuth, (req, res) => {
    209   const row = db.prepare('SELECT password_hash, google_sub FROM users WHERE id = ?').get(req.session.user.id);
    210   if (!row || !row.google_sub) {
    211     return res.redirect('/account?error=' + encodeURIComponent('Er is geen Google-account gekoppeld'));
    212   }
    213   if (!row.password_hash || row.password_hash === '!google-oauth') {
    214     return res.redirect('/account?error=' + encodeURIComponent('Stel eerst een wachtwoord in — anders kun je niet meer inloggen.'));
    215   }
    216   db.prepare('UPDATE users SET google_sub = NULL, updated_at = CURRENT_TIMESTAMP WHERE id = ?').run(req.session.user.id);
    217   res.redirect('/account?success=' + encodeURIComponent('Google-account ontkoppeld'));
    218 });
    219 
    220202// ==================== UPLOAD AVATAR ====================
    221203router.post('/avatar', requireAuth, (req, res) => {
Note: See TracChangeset for help on using the changeset viewer.