Support both email and phone login
Auto-detect whether the user entered an email or phone number. Email sends via Resend, phone sends via Twilio SMS. Users table has nullable phone and email columns; verification_codes uses a generic identifier field. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+4
-3
@@ -38,7 +38,8 @@ CREATE TABLE IF NOT EXISTS rsvps (
|
||||
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
phone TEXT NOT NULL UNIQUE,
|
||||
phone TEXT UNIQUE,
|
||||
email TEXT UNIQUE,
|
||||
name TEXT NOT NULL DEFAULT '',
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
@@ -51,7 +52,7 @@ CREATE TABLE IF NOT EXISTS sessions (
|
||||
|
||||
CREATE TABLE IF NOT EXISTS verification_codes (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
phone TEXT NOT NULL,
|
||||
identifier TEXT NOT NULL,
|
||||
code TEXT NOT NULL,
|
||||
expires_at DATETIME NOT NULL,
|
||||
used INTEGER NOT NULL DEFAULT 0
|
||||
@@ -61,4 +62,4 @@ CREATE INDEX IF NOT EXISTS idx_slots_event ON slots(event_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_claims_slot ON claims(slot_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_rsvps_event ON rsvps(event_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_sessions_user ON sessions(user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_verification_codes_phone ON verification_codes(phone);
|
||||
CREATE INDEX IF NOT EXISTS idx_verification_codes_identifier ON verification_codes(identifier);
|
||||
|
||||
Reference in New Issue
Block a user