feat(authenticate): separate login from signup with an explicit intent - #1912
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report for CI Build 33670668290Coverage increased (+0.4%) to 49.614%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
1cb69f7 to
fac50ad
Compare
fac50ad to
bf17da1
Compare
Frontier cannot tell a signup from a login: every strategy ends at getOrCreateUser, which returns the existing user or creates one, so a login with an unknown address silently creates the account. Adds a FlowIntent carried on flow metadata and both gates from the RFC's intent by strategy table. StartFlow is the fast path, rejecting a login with no account or a signup with one before an OTP is sent, for the strategies that know the email that early. User creation is the gate that matters, since every strategy reaches it and OIDC has no email until the callback. The intent also replaces the passkey guess: signup picks the register ceremony, login picks the login ceremony. An unspecified intent keeps today's create-or-get and today's guess, so existing clients and deployments are unaffected. Flow.Metadata is existing JSONB, so no migration. The accessors parse rather than assert, since JSONB does not return the types it was given, and are nil-receiver-safe so the caller without a flow needs no branch. Error mapping at the handlers and all consent work follow separately. Refs docs/rfcs/0002-explicit-consent-at-signup.md Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VW3nysiE4H83VQk6BroMYc
bf17da1 to
a336996
Compare
Summary
StartFlowis the fast path for the strategies that know the address up front, so a rejection lands before anything is mailed;getOrCreateUseris the gate that matters, since every strategy ends there. It now takes the flow, andErrLoginUserNotFound/ErrSignupUserExistsjoin the existing error block.StartFlowused to look the user up to decide between the passkey register and login ceremonies, which meant a passkey login could create an account; the intent now picks the ceremony, and an unspecified intent keeps the old guess.flow.Metadata(existing JSONB, no migration), read back through two nil-receiver-safe accessors that parse rather than assert — JSONB returns[]anyand an RFC 3339 string, not what it was given.applyMailOTPat the other end.