Files
zeekay 2e6b0f5b3c auth: email first, the link by default; /beta applies before the account
The first screen asks for the address alone. Every address is sent its link and code at once; a known account's password is a press away, a new one's is optional and typed twice. The emailed link lands on /auth/callback and hands its code to the waiting tab, signs in the browser that asked, or shows the code elsewhere. Apple leads the providers when IAM offers it. /beta asks its questions signed out and makes the account on /signup at the end, then goes on to the plan.
2026-10-21 22:02:11 -07:00

21 lines
943 B
TypeScript

/**
* What the panel asks for after the address where IAM says nothing of it, from
* what the application allows and nothing else. Pure, so the choice is tested
* without a browser.
*
* signing in, passwords allowed password: the link is sent, the
* password a press away
* on /signup, accounts made create: the link that proves the
* address and makes the account, a
* password to set a press away
* no password at all code: the link alone
*/
export type Allowed = { password: boolean; code: boolean; signup: boolean }
export type First = 'create' | 'password' | 'code'
export function first(methods: Allowed, signup: boolean): First {
if (!methods.password) return 'code'
if (!signup || !methods.signup) return 'password'
return 'create'
}