Prompt

How do I build password reset and account recovery flows?

Technology / Identity & Access1 observationLast seen Oct 28, 2026

Latest observation

Oct 28, 2026OpenAI APIWeb search: off

Here’s a practical way to build password reset and account recovery flows that are secure, user-friendly, and hard to abuse.


1) Start with the goals

A good recovery system should:

  • let legitimate users regain access quickly
  • prevent account takeover
  • avoid leaking whether an account exists
  • resist phishing, replay, brute force, and social engineering
  • support users who lose both password and email access

2) Use separate flows for separate problems

Password reset

Use when the user:

  • knows the account exists
  • cannot log in because they forgot their password

Account recovery

Use when the user:

  • lost access to email/phone/2FA
  • changed devices
  • is locked out of multiple factors
  • needs identity verification beyond password reset

Don’t mix them into one ambiguous flow. Keep reset simple; keep recovery more rigorous.


3) Recommended password reset flow

Step 1: User requests reset

User enters email/username.

Important:

  • Always respond with the same message:
    • “If an account exists for that email, we’ve sent instructions.”
  • Do not reveal whether the account exists.

Step 2: Generate a reset token

Create a:

  • cryptographically random token
  • single-use
  • short-lived
  • stored hashed server-side

Recommended properties:

  • at least 128 bits of entropy
  • expire in 15–60 minutes
  • invalidate after first use
  • invalidate old tokens when a new one is issued

Step 3: Send reset link

Send an email with a link like:

https://example.com/reset-password?token=...

Best practices:

  • link should use HTTPS only
  • token should be long and unguessable
  • avoid putting sensitive info in the URL besides the token
  • do not include the new password in the email

Step 4: User sets a new password

When token is valid:

  • prompt for new password
  • require confirmation optionally
  • enforce password policy
  • check against breached password lists if possible

Step 5: Invalidate sessions

After password reset:

  • revoke all existing sessions and refresh tokens
  • optionally keep the current session if the user reset from an already-authenticated device, but be careful
  • notify the user by email that password was changed

Step 6: Log and monitor

Record:

  • reset requested
  • token issued
  • token used
  • password changed
  • IP/device metadata

This helps detect abuse and support investigations.


4) Recommended account recovery flow

Account recovery should be stronger than password reset because attackers often target it.

Use layered verification, for example:

  • verified email
  • verified phone
  • TOTP backup code
  • WebAuthn/passkey recovery
  • backup/recovery codes
  • trusted device approval
  • support-assisted recovery with strong controls

Good options

  1. Recovery codes

    • give users a set of one-time backup codes at enrollment
    • allow download/print
    • store hashed versions only
  2. Secondary contact method

    • backup email or phone
    • note that phone is weaker than email or passkeys
  3. Trusted devices

    • permit recovery from a previously trusted device with additional checks
  4. Passkeys / WebAuthn

    • best modern option
    • can reduce reliance on passwords entirely
  5. Human support with verification

    • only for high-value or edge-case accounts
    • require strict anti-fraud controls

Avoid

  • knowledge-based security questions
  • easily guessed personal info
  • weak SMS-only recovery for sensitive accounts
  • overly permissive support overrides

5) Security requirements you should include

Token design

For reset/recovery tokens:

  • random, high entropy
  • single use
  • short TTL
  • hashed at rest
  • bound to purpose
  • optionally bound to device or request context

Rate limiting

Apply rate limits on:

  • reset requests per account
  • reset requests per IP
  • token verification attempts
  • recovery attempts
  • login attempts after reset

Enumeration protection

Always use neutral responses:

  • “If the account exists, we sent an email”
  • same timing as much as practical
  • avoid different error messages for valid vs invalid users

Session invalidation

After:

  • password reset
  • recovery completion
  • email change
  • MFA reset

Revoke:

  • sessions
  • refresh tokens
  • remembered devices if needed

Notifications

Send alerts for:

  • password reset requested
  • password changed
  • recovery initiated
  • recovery completed
  • email/phone changed

These alerts help users detect compromise early.

MFA handling

If the user has MFA enabled:

  • avoid automatically removing MFA on password reset unless your policy requires it
  • if MFA is lost, use a separate MFA recovery flow
  • recovery should be harder than normal password reset

6) UX patterns that help without weakening security

Make it easy to find

  • “Forgot password?”
  • “Can’t access your email?”
  • “Need help recovering your account?”

Keep steps clear

  • request reset
  • check email
  • open link
  • choose new password
  • confirm success

Give useful but safe guidance

  • “Check spam/junk folders”
  • “Link expires in 30 minutes”
  • “Request a new link if needed”

Avoid risky UX

  • showing partial account details that help attackers
  • providing too much info when recovery fails
  • long-lived links
  • recovery via support email only

7) Data model ideas

You’ll usually want:

Users

  • id
  • email
  • password_hash
  • mfa_enabled
  • recovery_methods_enabled
  • account_status

Reset tokens

  • id
  • user_id
  • token_hash
  • purpose
  • expires_at
  • used_at
  • requested_ip
  • requested_user_agent

Recovery events

  • id
  • user_id
  • type
  • status
  • metadata
  • created_at

Trusted devices / sessions

  • session_id
  • user_id
  • refresh_token_hash
  • device info
  • revoked_at

8) Implementation checklist

Password reset

  • neutral “account exists” response
  • random one-time token
  • short expiration
  • hashed token storage
  • HTTPS link
  • rate limiting
  • password policy enforcement
  • session revocation
  • event notifications
  • audit logs

Account recovery

  • separate recovery path
  • backup codes and/or passkeys
  • secondary verified contact method
  • stronger verification than reset
  • manual review for high-risk cases
  • anti-abuse logging and rate limits

9) Common mistakes to avoid

  • sending plaintext passwords by email
  • using security questions
  • using long-lived reset links
  • making reset tokens reusable
  • not invalidating existing sessions
  • revealing whether an account exists
  • relying on SMS alone for sensitive accounts
  • allowing support staff to bypass controls casually
  • making recovery easier than login

10) A solid modern approach

If you want a robust setup today:

  • use passwordless/passkey-first login if possible
  • keep passwords as fallback
  • offer email-based password reset
  • provide backup codes
  • support WebAuthn/passkey recovery
  • use risk-based step-up verification for unusual recovery requests

If you want, I can also provide:

  1. a reference architecture,
  2. a database schema, or
  3. example backend code for password reset and recovery.

Brands

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.