Skip to content

fix(login): accept letter-based email OTP codes at the code prompt#69

Merged
Bccorb merged 1 commit into
mainfrom
fix/login-email-otp-letters
Jul 21, 2026
Merged

fix(login): accept letter-based email OTP codes at the code prompt#69
Bccorb merged 1 commit into
mainfrom
fix/login-email-otp-letters

Conversation

@Bccorb

@Bccorb Bccorb commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Problem

seamless login with an email identifier could never accept a real email OTP.

The auth API generates email OTPs as 6 uppercase letters, but the CLI's code prompt validated with /^\d{4,8}$/ and told the user to "Enter the numeric code from the message." Every valid letter-based code was rejected, so email login was effectively broken. (Phone OTPs are digits and worked fine.)

Fix

Make the code prompt channel-aware:

  • Thread the login channel (email | phone) into the getCode callback ctx in completeLogin — the flow already knew the channel internally; it just wasn't exposed to the prompt.
  • Email logins now accept a 6-letter code (/^[A-Za-z]{6}$/, case-insensitive), normalize it to uppercase before verifying (the verify endpoint uppercases too), and show an ABCDEF placeholder with letter-specific guidance.
  • Phone logins keep numeric validation and the 123456 placeholder.

Tests

  • loginFlow.test.ts: asserts channel is passed to getCode.
  • login.test.ts: email letter validation + placeholder, lowercase→uppercase normalization before verify, and phone digit validation.

Full suite green (552 passed), typecheck clean. A patch changeset is included.

Note: unrelated to seamless login --local (which auto-fills the code and bypasses this prompt).

Email OTPs are six letters, but the login code prompt validated only
digits (/^\d{4,8}$/) and told users to enter a numeric code, so a real
email OTP could never be entered. Thread the login channel into the
getCode callback and make the prompt channel-aware: six letters
(case-insensitive, uppercased before verifying) for email, digits for
phone, with matching placeholder text.
@Bccorb
Bccorb merged commit c4d23e5 into main Jul 21, 2026
1 check failed
@Bccorb
Bccorb deleted the fix/login-email-otp-letters branch July 21, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant