Changeset 640b39c in Klonkt for src/routes/auth.js


Ignore:
Timestamp:
06/14/2026 04:25:27 PM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
a64f642
Parents:
8cb1dc7
Message:

auth: read-only view accounts (view everything, modify nothing)

New users.readonly column + readonly in the session. Global guard in server.js
blocks every state-modifying method (POST/PUT/PATCH/DELETE) for read-only
accounts -> no comments, saves, settings, nothing. GET remains free, so they
can view everything (including admin panels). Sticky "read-only demo" banner in
the shell when such an account is logged in.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/auth.js

    r8cb1dc7 r640b39c  
    7676    id: user.id, username: user.username, email: user.email, role: user.role,
    7777    avatar_url: user.avatar_url, palette: user.palette, theme: user.theme,
     78    readonly: !!user.readonly,
    7879  };
    7980  res.redirect(next || '/');
     
    290291      id: user.id, username: user.username, email: user.email, role: user.role,
    291292      avatar_url: user.avatar_url, palette: user.palette, theme: user.theme,
     293      readonly: !!user.readonly,
    292294    };
    293295    res.redirect(next || '/');
Note: See TracChangeset for help on using the changeset viewer.