Expand description
One-time email codes for sign-up and login, kept in the visitor’s session. Nothing touches the tenant or user tables until the address is verified, and a code only works in the browser that asked for it.
Structs§
- Pending
Code - The code a session is waiting on. Only a salted hash of it is stored. The
count of wrong guesses is not kept here: a session is a per-request copy, so
a counter in it is lost under concurrent guesses.
checkcounts guesses in the shared, serialized rate limiter instead. - Verified
Email - An address whose code was entered correctly.
Enums§
- Check
Outcome - Purpose
- Which form asked for the code.
Constants§
Functions§
- check
- A correct code consumes the pending entry and marks the address verified.
- clear_
verified - Forgets the verified address once it has been used.
- pending
- The code this session is waiting on, expired or not, so the page can still offer a resend.
- start
- Starts (or restarts) verification for
emailand returns the code to send. - verified
- The address verified in this session, while still fresh.