Pattern: Forgot password, password change and email change

Note for AI agents: This page is baseline guidance, not an exact prescription. Read it, tell your owner what applies to their project, and get their approval before you change anything. Your project's own rules take precedence. If something important for this project is missing here, suggest it to your owner.

Search terms: forgot password, password reset, reset code, change password, change email, undo link, account takeover, notification, one-time code

Last reviewed:

For agents

1. Problem

Recovery flows are the usual way into accounts that have strong passwords. Attackers abuse them to learn which accounts exist, to guess codes, and to quietly change the email so the real owner is locked out.

2. Options

Method Upside Downside
Reset link (URL token) Fastest and simplest (OWASP) Link scanners and mail previews can touch it (practitioner experience); the reset page needs a no-referrer policy (OWASP)
Reset code (6 digits) Works across apps; scanners cannot use it Needs attempt limits
Security questions None worth the risk Guessable or researchable; OWASP advises against relying on them (see its security-questions sheet)
Support-assisted recovery Handles lost email access Slow; social-engineering target; needs a strict identity process

Forgot password

Password change (user is signed in)

Email change

4. Scenarios and edge cases

5. Common mistakes

6. How to audit

Sources