Admin password login + attendee profile self-service

- contacts.password: admin-only APPE Admin login password (event-independent);
  must match the bcrypt hash in auth.users.encrypted_password (set in Supabase).
- APPE Admin login is now email + password (was QR token).
- update_my_profile RPC (security definer, scoped to current_email()): attendees
  set their LinkedIn URL + show_email / show_linkedin toggles from the Profile.
- Convivo Profile gains a 'Profile settings' card (LinkedIn + 2 toggles + Save).
- Visibility enforced server-side in the public projection (linkedin nulled when
  show_linkedin off, email omitted when show_email off).
- Seed: admin password appe-admin-2026; staff keep QR tokens as auth passwords.
- Docs updated (schema, rpcs, seed, admin-app, screens, api-client,
  architecture, next-steps, README, docker-compose).

Co-authored-by: Stephan Charles <[email protected]>
Co-authored-by: Amelia Hernandez <[email protected]>
Co-authored-by: Markus Franz <[email protected]>
Co-authored-by: Sabrina Hota <[email protected]>
Co-authored-by: Nilüfer Doğan <[email protected]>
This commit is contained in:
committed 2026-08-23 14:11:26 +02:00
1 parent 2f3952dc71
commit 0221b1a8c0
19 files changed
+290 -59

No files matched your search

+4 -3
View File
@@ -5,7 +5,8 @@ import type { Contact } from '../lib/types';
interface AuthState {
contact: Contact | null;
loading: boolean;
signIn: (email: string, qrToken: string) => Promise<void>;
/** Sign in with the admin's email + password (event-independent). */
signIn: (email: string, password: string) => Promise<void>;
signOut: () => Promise<void>;
}
@@ -72,10 +73,10 @@ export function AuthProvider({ children }: { children: ReactNode }) {
};
}, []);
async function signIn(email: string, qrToken: string) {
async function signIn(email: string, password: string) {
const { data, error } = await supabase.auth.signInWithPassword({
email,
password: qrToken,
password,
});
if (error) throw new Error(error.message);
+2
View File
@@ -19,6 +19,8 @@ export interface Contact {
show_email: boolean;
show_linkedin: boolean;
is_admin: boolean;
/** Admin-only: the APPE Admin login password (event-independent). */
password: string | null;
created_at: string;
}
+10 -9
View File
@@ -6,17 +6,17 @@ export function Login() {
const { signIn } = useAuth();
const { push } = useToast();
const [email, setEmail] = useState('');
const [token, setToken] = useState('');
const [password, setPassword] = useState('');
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
async function onSubmit(e: FormEvent) {
e.preventDefault();
if (!email.trim() || !token.trim()) return;
if (!email.trim() || !password.trim()) return;
setBusy(true);
setError(null);
try {
await signIn(email.trim(), token.trim().toUpperCase());
await signIn(email.trim(), password);
push('success', 'Welcome back');
} catch (err) {
const msg = err instanceof Error ? err.message : 'Sign in failed';
@@ -34,7 +34,7 @@ export function Login() {
<div className="logo"><img src="/icon-192.png" alt="APPE" /></div>
<div>
<h1>APPE Admin</h1>
<p>Sign in with your admin QR token and email.</p>
<p>Sign in with your admin email and password.</p>
</div>
</div>
<form className="login-form" onSubmit={onSubmit}>
@@ -51,12 +51,13 @@ export function Login() {
/>
</div>
<div className="field">
<label>QR token</label>
<label>Password</label>
<input
className="input mono"
placeholder="CVV-ADM-0001"
value={token}
onChange={(e) => setToken(e.target.value)}
className="input"
type="password"
placeholder="••••••••••"
value={password}
onChange={(e) => setPassword(e.target.value)}
autoComplete="current-password"
required
/>