Add 6-digit login code for mobile authentication
Magic links open in the device browser, not the OAuth in-app browser, so the session doesn't carry over. A login code lets mobile users type a 6-digit code from their email into the login page instead. - Generate 6-digit numeric code alongside magic link token - Store code in magic_tokens table - Add verify-code step to login API endpoint - Show code input UI after magic link is sent - Include code in email template - i18n keys for code UI (en + de) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2a94af5655
commit
3bcb1fce7c
7 changed files with 130 additions and 20 deletions
|
|
@ -49,6 +49,7 @@ export const magicTokens = journalSchema.table("magic_tokens", {
|
|||
id: text("id").primaryKey(),
|
||||
email: text("email").notNull(),
|
||||
token: text("token").notNull().unique(),
|
||||
code: text("code"),
|
||||
purpose: text("purpose").notNull().default("login"),
|
||||
expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
|
||||
usedAt: timestamp("used_at", { withTimezone: true }),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue