feat: add duplicate email detection via auth hook with fallback

- Add before-user-created hook function for server-side duplicate email detection
- Implement fallback detection using identities array check (Supabase limitation)
- Update signUpWithPassword to detect duplicate emails via hook errors or empty identities
- Add error handling in login page to show duplicate email errors and auto-switch to login mode
- Add auth hook setup documentation and test scripts
- Add password reset and update password flows
- Add email templates for signup confirmation and password reset
This commit is contained in:
colinislit
2025-11-19 11:03:46 +01:00
parent 114e7d200d
commit 2505b27437
21 changed files with 3671 additions and 201 deletions

52
docs/emails/README.md Normal file
View File

@@ -0,0 +1,52 @@
# Email Templates voor Supabase
Deze directory bevat HTML email templates die gebruikt kunnen worden in Supabase Authentication emails.
## Beschikbare Templates
### 1. `confirm-signup.html`
**Gebruik:** Email bevestiging voor nieuwe gebruikersregistratie
**Supabase variabelen:**
- `{{ .ConfirmationURL }}` - De bevestigingslink die de gebruiker moet klikken
**Waar te gebruiken in Supabase:**
- Authentication → Email Templates → Confirm signup
---
### 2. `reset-password.html`
**Gebruik:** Wachtwoord reset email
**Supabase variabelen:**
- `{{ .ConfirmationURL }}` - De reset link die de gebruiker moet klikken
**Waar te gebruiken in Supabase:**
- Authentication → Email Templates → Reset Password
---
## Hoe te gebruiken in Supabase
1. Log in op je Supabase Dashboard
2. Ga naar **Authentication****Email Templates**
3. Selecteer het juiste template type (Confirm signup of Reset Password)
4. Kopieer de volledige HTML inhoud van het corresponderende `.html` bestand
5. Plak deze in het Supabase email template veld
6. Klik op **Save**
## Design Kenmerken
- **Brand kleur:** Teal (#0D9488) - consistent met AI Speedrun branding
- **Responsive:** Werkt op desktop en mobiel
- **Email client compatibiliteit:** Gebruikt table-based layout voor maximale compatibiliteit
- **Toegankelijkheid:** Goede contrast ratios en duidelijke call-to-action buttons
- **Nederlandse taal:** Alle teksten zijn in het Nederlands
## Aanpassingen
Als je de templates wilt aanpassen:
- Kleuren kunnen worden aangepast in de inline styles (zoek naar `#0D9488` voor de primary kleur)
- Teksten kunnen direct worden aangepast in de HTML
- Let op: Supabase gebruikt Go template syntax (`{{ .VariableName }}`), dus behoud deze variabelen