Files
windmill/backend/migrations/20260126235947_lowercase_emails.up.sql
Ruben Fiszel 7892887f01 feat: add LOGIN_DOMAIN env var to normalize emails during external login
Add LOGIN_DOMAIN environment variable that appends a domain to emails
missing one during external login (OAuth/SAML/SCIM). When set, emails
without '@' will have '@{LOGIN_DOMAIN}' appended.

Example: LOGIN_DOMAIN=example.com transforms "john" to "john@example.com"

Also includes a migration to lowercase existing emails in critical tables:
- password (primary user identity)
- usr (workspace users)
- email_to_igroup (instance group memberships)
- token (active sessions)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 00:01:35 +00:00

15 lines
683 B
SQL

-- Normalize emails to lowercase for consistency with external login normalization
-- This migration lowercases email columns in critical authentication tables
-- Lowercase emails in password table (primary user identity)
UPDATE password SET email = LOWER(email) WHERE email != LOWER(email);
-- Lowercase emails in usr table (workspace users)
UPDATE usr SET email = LOWER(email) WHERE email != LOWER(email);
-- Lowercase emails in email_to_igroup table (instance group memberships)
UPDATE email_to_igroup SET email = LOWER(email) WHERE email != LOWER(email);
-- Lowercase emails in token table (active sessions)
UPDATE token SET email = LOWER(email) WHERE email != LOWER(email);