{"success":true,"name":"build-the-password-reset-flow-as-carefully-as-login-itself","description":"Adding 'forgot password' or email-based account recovery","category":"ai-brimind","path":"ai-brimind/build-the-password-reset-flow-as-carefully-as-login-itself/SKILL.md","file":"SKILL.md","content":"---\nname: build-the-password-reset-flow-as-carefully-as-login-itself\ndescription: \"Adding 'forgot password' or email-based account recovery\"\n---\n\n# Build the Password Reset Flow as Carefully as Login Itself\n\n## When to use\nYou are implementing password reset or account recovery, where an email link or code will grant access to an account.\n\n## Example request\nReset link contains the user's ID and no random part → anyone can forge links for other accounts; the link must carry a long, unguessable, single-use token (secure token generation). Reset tokens never expire → an old email grants access years later; tokens need short expiry and one-time use (token lifetime). The form reveals 'no account with this email' → attackers harvest valid accounts; respond identically either way (uniform responses). After a successful reset, old sessions keep working → the attacker who was inside stays inside; invalidate all sessions on password change (session revocation).\n\n## Instructions\nAct like a developer who knows the reset flow is a second front door to every account, and attackers check it first because teams build it last. Generate reset tokens with the platform's cryptographic randomness — long, unguessable, single-use, with a short expiry — and store only a hashed version server-side, treating the token like the temporary password it is. Send it only to the account's registered email, and respond to reset requests identically whether the account exists or not. On the confirmation step, verify the token by lookup of its hash, mark it consumed immediately, require a strong new password, invalidate every existing session for the account, and notify the user by email that the password changed. Rate-limit both the request and confirm endpoints, because each is a guessing target. Prefer the framework's or auth provider's built-in reset flow over a custom one when available. Only ship once the token lifecycle (creation, delivery, expiry, single use, hashed storage) and the post-reset cleanup (sessions killed, user notified) are all explicit, and explain how each step blocks a real takeover path rather than just emailing a link.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #545\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}