// ── Supabase signUp ───────────────────────────────────────── async function signUpUser() { if (!DB_CONFIGURED || !db) { doDemo(); return; } var inp = getAuthInputs(); if (!inp.email || !inp.pass) { toast('Please enter email and password'); return; } var btn = document.getElementById('auth-confirm-btn'); if(btn){btn.textContent='Creating account...';btn.disabled=true;} try { var res = await db.auth.signUp({ email: inp.email, password: inp.pass, options: { data: { role: _selRole } } }); if (res.error) throw res.error; toast('Account created! Check your email to confirm then sign in.'); S.log('SIGNUP', inp.email, 'info'); closeMod('auth-modal'); } catch(err) { toast('Sign up failed: ' + S.esc(err.message)); } finally { if(btn){btn.textContent='Sign In / Demo →';btn.disabled=false;} } } // ── Supabase signIn ───────────────────────────────────────── async function signInWithEmail() { if (!DB_CONFIGURED || !db) { doDemo(); return; } var inp = getAuthInputs(); if (!inp.email || !inp.pass) { doDemo(); return; } var btn = document.getElementById('auth-confirm-btn'); if(btn){btn.textContent='Signing in...';btn.disabled=true;} try { // delegate to signInWithEmail for cleaner flow await signInWithEmail(); return; if (res.error) throw res.error; currentUser = res.data.user; var role = (res.data.user.user_metadata && res.data.user.user_metadata.role) || 'seller'; S.RBAC.setFromToken(S.JWT.generate(role)); closeMod('auth-modal'); updateRoleBadge(); toast('Welcome back, ' + S.esc(res.data.user.email.split('@')[0]) + '!'); S.log('SUPABASE_AUTH', res.data.user.email, 'info'); } catch(err) { toast('Sign in failed: ' + S.esc(err.message)); S.log('AUTH_FAILED', err.message, 'error'); } finally { if(btn){btn.textContent='Sign In / Demo →';btn.disabled=false;} } } // ── Sign out ──────────────────────────────────────────────── async function signOut() { if (db) await db.auth.signOut(); currentUser = null; S.RBAC.currentRole='visitor'; S.RBAC.token=null; updateRoleBadge(); toast('Signed out'); S.log('SIGNOUT','','info'); } !DOCTYPE html>
Thousands of private and dealer listings. Real prices. Zero middlemen.
Reach tens of thousands of in-market buyers across every county in Ireland. Quality leads every day.
Private sellers list one car completely free. No hidden fees, no commission taken. Live within 24 hours.
Demo: select a role to simulate JWT authentication
or choose a demo role below (no database required):
Select your account type:
| Time | Action | Detail | Role | Sev |
|---|