Archived
Add read-only admin impersonation
Admins (with 2FA) can view the site as a non-admin user for up to 30 minutes, with a required reason and a "Viewing as" banner. It is strictly read-only: a guard mounted before every route refuses any write made with an impersonation token, protect/optionalAuth check the session is live, and GET handlers skip the price-refresh writes. Start, end, reason and every page/API call (including blocked attempts) are audited; optional email to the user. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CP62L9JxHomA36aYP1ekCe
This commit is contained in:
@@ -36,6 +36,7 @@ export function setConsent(v: "accepted" | "declined") {
|
||||
export function analyticsSessionId(): string | undefined {
|
||||
if (getConsent() !== "accepted") return undefined;
|
||||
try {
|
||||
if (localStorage.getItem("hope_events_impersonation")) return undefined;
|
||||
let id = localStorage.getItem(SESSION_KEY);
|
||||
if (!id) {
|
||||
id = crypto.randomUUID();
|
||||
|
||||
Reference in New Issue
Block a user