Sign in with a passkey or a code
A returning user opens the sign-in page and the browser offers their passkey; a verified passkey goes straight to Home. If they cancel the prompt or have no passkey on this device, they sign in with email and password, then type a 6-digit code sent by SMS, which expires after 5 minutes and can be sent again. Five wrong codes lock sign-in for 15 minutes, and the locked page links to account recovery.
What UJN shows here Point at a note to see its part of the drawing
The source (38 lines)
mfa.puml
@startujnrender { direction: down; arrow_spacing: 24 }journey MFA_SIGNIN "Sign in with a passkey or a code"description: "The browser offers a passkey; without one, a password and then a code by SMS"unique_id_friendly: mfa_signin start from_site { type: deep-link; description: "Returning user, signed out"; route: /signin }action passkey { type: auth; title: "Passkey prompt"; description: "Offered before the password" }view password { title: "Sign in"; description: "Email and password"; route: /signin }action check_password { title: "Check password" }action send_code { type: message; title: "Send SMS code"; description: "6 digits"; channel: SMS }view enter_code { title: "Enter the code"; description: "Sent to the phone ending 42"; route: /signin/code }action countdown { type: wait; title: "Code expires"; description: "Countdown on the code screen"; timeout: 5 min }view code_expired { type: toast; title: "Code expired"; description: "Send a new one" }action check_code { title: "Check code"; description: "5 wrong codes lock sign-in" }data accounts { title: "Accounts"; location: "table accounts" }view home { title: "Home"; description: "Signed in"; route: /home }view locked { title: "Sign-in locked"; description: "Try again in 15 minutes"; route: /signin/locked }ref recover { journey: ACCOUNT_RECOVERY; title: "Recover your account"; description: "Lost phone or no access" } from_site --> passkeypasskey --> home : verifiedpasskey --> password : canceled or no passkeypassword -up-> passkey : [Use a passkey]password --> check_password : [Sign in] { payload: [email, password] }check_password --> send_code : correctcheck_password .x.> password : wrong passwordsend_code --> enter_codesend_code --> countdowncountdown -left-x-> code_expired : timeoutenter_code -up-> send_code : [Resend code]enter_code --> check_code : [Verify] { payload: [code] }check_code -left-> accounts { payload: [wrong_codes, locked_until] }check_code --> home : correctcheck_code .x.> enter_code : wrong, tries leftcheck_code -x-> locked : fifth wrong codelocked -right-> recover : [Recover your account]@endujn