ACC-2Required
Prove the email address before trusting it
Mark an email address as verified only after someone opens a link or types a code sent to it. Until then, send no account data there and never use it to link accounts.
How to do it
Store email_verified_at as a time, empty at sign-up. Send a link with a single-use token, valid for 24 hours. Build the token as the sign-in links rule says, hashed, single use and behind a button page. A typed 6-digit code follows that rule's shorter expiry and try limit, because a million guesses are quick. The link only confirms the address and never signs anyone in, so it may last longer than a sign-in link. People may use the product while unverified, but block invitations, exports, billing email and linking a provider login. Allow a resend after 60 seconds, at most 5 an hour. A verified address proves access to an inbox only, so it never replaces a sign-in factor.
Examples
JavaScript example
const NEEDS_VERIFIED_EMAIL = new Set(['invite', 'export', 'link-identity', 'billing-email']);
export function assertEmailVerified(user, action) {
if (NEEDS_VERIFIED_EMAIL.has(action) && !user.emailVerifiedAt) {
throw new ForbiddenError('Confirm your email address first. We sent you a link.');
}
}
Python example
NEEDS_VERIFIED_EMAIL = {"invite", "export", "link-identity", "billing-email"}
def assert_email_verified(user, action: str) -> None:
if action in NEEDS_VERIFIED_EMAIL and user.email_verified_at is None:
raise Forbidden("Confirm your email address first. We sent you a link.")
How to check
Sign up with a test address and skip the link. Invite a colleague, export data and link a provider login with the same address. Each is refused. Open the link, and all three work.
Sources
- OpenID Connect Core 1.0 on standard claims and email_verified
- OWASP Authentication Cheat Sheet on secure federated account linking
Related rules
- EML-21 Confirm each sign-up with a link in Email
- ACC-69 Make sign-in and reset links single-use and short-lived in Accounts and identity
- ACC-71 Let people run an account on passkeys alone in Accounts and identity
- ACC-79 Give the same answer for known and unknown accounts in Accounts and identity
- APS-15 Trust an email domain only after strict parsing in Application security
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/accounts/sign-up/email-verification">Agent Wranglers accounts and identity playbook</a>. In code you write, add a comment next to it with the same link.