Skip to content

Fix admin redirects and add consent-based visitor alerts - #11

Merged
Dev-Sahad merged 1 commit into
mainfrom
agent/add-dashboard-cv
Jul 20, 2026
Merged

Fix admin redirects and add consent-based visitor alerts#11
Dev-Sahad merged 1 commit into
mainfrom
agent/add-dashboard-cv

Conversation

@Dev-Sahad

@Dev-Sahad Dev-Sahad commented Jul 20, 2026

Copy link
Copy Markdown
Owner

What changed

  • fixed password and OAuth login redirects with a browser-safe Supabase client and full navigation
  • redirected already-authenticated admins away from the login page
  • added an admin email allowlist and optional Supabase user-ID check
  • added a visitor prompt for name, optional phone, and explicitly consented precise geolocation
  • enriched Discord visitor alerts with identity, device, browser, IP, ISP, source, screen, timezone, approximate location, precise coordinates, accuracy, and a map link
  • protected live viewer details from unauthenticated reads
  • surfaced consented visitor identity and precise map links in the admin webhook dashboard

Why

The login component could retain a server-created null client and depended on a delayed client-side route change, leaving successful logins on the login page. Visitor notifications could only show anonymous or IP-estimated data, and the live viewer endpoint exposed session summaries without an admin check.

Impact

Admin sign-in now performs a reliable dashboard navigation and existing admins are redirected automatically. Visitors can voluntarily share their name, optional phone, and browser-approved precise location; they can also skip the prompt. Precise location is never requested or sent without consent.

Validation

  • targeted ESLint checks
  • npx tsc --noEmit
  • npm run build
  • unauthenticated /admin/dashboard: 307 to /admin/login
  • /admin/login: 200
  • unauthenticated GET /api/visitors: 401
  • public visitor heartbeat and consented-identify events: 200

Required configuration

  • set ADMIN_EMAIL and optionally ADMIN_USER_ID in Vercel
  • configure DISCORD_WEBHOOK_URL or save a webhook URL in the admin webhook settings

@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
portfolio-v1 Ready Ready Preview, Comment Jul 20, 2026 11:32am

@Dev-Sahad Dev-Sahad changed the title fix: restore admin redirects and enrich visitor alerts Fix admin redirects and add consent-based visitor alerts Jul 20, 2026
@Dev-Sahad
Dev-Sahad marked this pull request as draft July 20, 2026 11:33
@Dev-Sahad
Dev-Sahad marked this pull request as ready for review July 20, 2026 11:33
@Dev-Sahad
Dev-Sahad merged commit 5c2d3ec into main Jul 20, 2026
4 of 5 checks passed
Comment thread src/hooks/useVisitor.ts
const alreadyNotified = sessionStorage.getItem('_visited')
if (!alreadyNotified) {
const visitorContext = () => ({
sessionId: sid,
@Dev-Sahad
Dev-Sahad deleted the agent/add-dashboard-cv branch July 30, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants