From 7f693977257f289dba6ef8de2856bb1d9e27c816 Mon Sep 17 00:00:00 2001 From: Lorenzo Corallo Date: Thu, 15 Oct 2026 13:33:12 +0200 Subject: [PATCH 1/3] feat(auth): add privacy links and compact dev sign-in --- src/components/dev-login.tsx | 96 ++++++++++++++++++++++------------- src/components/login-page.tsx | 17 +++++-- src/dev/personas.ts | 14 ++--- src/routes/__root.tsx | 24 ++++++++- src/styles.css | 3 ++ 5 files changed, 106 insertions(+), 48 deletions(-) diff --git a/src/components/dev-login.tsx b/src/components/dev-login.tsx index e100a31..0a0cfd6 100644 --- a/src/components/dev-login.tsx +++ b/src/components/dev-login.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from "react"; +import { useEffect, useId, useState } from "react"; import { FlaskConical, TriangleAlert } from "lucide-react"; import { cn } from "cn"; import { buttonVariants } from "@/components/ui/button"; @@ -20,6 +20,8 @@ import { export function DevLoginPanel({ redirect }: { redirect: string }) { const [personas, setPersonas] = useState([]); const [oauthQuery, setOauthQuery] = useState(); + const [open, setOpen] = useState(false); + const listId = useId(); useEffect(() => { // Read from the address bar as Better Auth's client does, so the signature still matches. @@ -40,41 +42,67 @@ export function DevLoginPanel({ redirect }: { redirect: string }) { return (
-
-

-

-

- Local development only. Signs you in as a test person, no account needed. -

+

+ +

+ -
); } diff --git a/src/components/login-page.tsx b/src/components/login-page.tsx index 7352bdf..09b4661 100644 --- a/src/components/login-page.tsx +++ b/src/components/login-page.tsx @@ -20,7 +20,7 @@ const providers = [ export function LoginLayout({ children, wide = false }: { children: ReactNode; wide?: boolean }) { return ( -
+
@@ -37,7 +37,6 @@ export function LoginLayout({ children, wide = false }: { children: ReactNode; w {children} -

PoliNetwork APS

@@ -225,10 +224,18 @@ export function LoginPage({ callbackURL = "/" }: { callbackURL?: string }) {

)} +

- {oauthFlow - ? "After signing in you'll review what the application can access before anything is shared." - : "New here? Continue with an account to get started. You can add a passkey once you're signed in."} + By continuing, you acknowledge that you have read and understood our{" "} + + Privacy Policy. +

diff --git a/src/dev/personas.ts b/src/dev/personas.ts index eabd847..0cec4ff 100644 --- a/src/dev/personas.ts +++ b/src/dev/personas.ts @@ -78,7 +78,7 @@ export const DEV_PERSONAS: DevPersona[] = [ id: DEV_ADMIN_ID, name: "Ada Admin", email: "admin@polinetwork.test", - description: "Master Admin: every permission", + description: "Master Admin", accounts: [{ providerId: "google", accountId: "dev-admin" }], }, { @@ -86,7 +86,7 @@ export const DEV_PERSONAS: DevPersona[] = [ id: "dev-staff", name: "Sam Staff", email: "staff@polinetwork.test", - description: "Can read the user directory and roles, nothing else", + description: "Can read the user directory and roles", accounts: [{ providerId: "google", accountId: "dev-staff" }], roles: [ { @@ -103,7 +103,7 @@ export const DEV_PERSONAS: DevPersona[] = [ id: "dev-student", name: "Stella Student", email: "student@polinetwork.test", - description: "Verified Polimi student with Telegram linked, no admin access", + description: "Verified Polimi student with Telegram linked", accounts: [ { providerId: "google", accountId: "dev-student" }, { @@ -119,7 +119,7 @@ export const DEV_PERSONAS: DevPersona[] = [ id: "dev-member", name: "Nico Newcomer", email: "member@polinetwork.test", - description: "Just signed up with Google: no statuses, no roles", + description: "Blank login with Google", accounts: [{ providerId: "google", accountId: "dev-member" }], }, ]; @@ -135,8 +135,8 @@ export function listPersonas(): DevPersonaSummary[] { description, ...(id === DEV_ADMIN_ID && !env.IDP_ADMIN_USER_IDS.includes(DEV_ADMIN_ID) ? { - warning: `Add ${DEV_ADMIN_ID} to IDP_ADMIN_USER_IDS in .env.local to make this Master Admin.`, - } + warning: `Add ${DEV_ADMIN_ID} to IDP_ADMIN_USER_IDS in .env.local to make this Master Admin.`, + } : {}), })); } @@ -144,7 +144,7 @@ export function listPersonas(): DevPersonaSummary[] { type Writer = Parameters[0]>[0]; /** Thrown instead of silently moving an identity between people. */ -export class DevFixtureConflict extends Error {} +export class DevFixtureConflict extends Error { } /** Finds the fixture role by its stable ID, so a key renamed in the role editor still matches; * then by key, so a role created by hand under that key is reused rather than collided with. */ diff --git a/src/routes/__root.tsx b/src/routes/__root.tsx index 4dfbcc2..4acc1ba 100644 --- a/src/routes/__root.tsx +++ b/src/routes/__root.tsx @@ -41,8 +41,28 @@ function RootDocument({ children }: { children: React.ReactNode }) {