Treat password reset like a temporary sign-in
Originally published on Quest Log. A person who forgets a password is asking your app for a new way into an existing account. That makes resetting a password an authentication decision. The email template, form, and con
Originally published on Quest Log.
A person who forgets a password is asking your app for a new way into an existing account. That makes resetting a password an authentication decision. The email template, form, and confirmation page matter because they carry that decision from one system to the next.
Picture a customer who needs to get into a billing portal before an invoice is due. They start at the sign-in screen, request a link, and open it on a phone. Maybe they finish there. Maybe they switch to a laptop. The product needs to help them finish without leaving an open route into the account for whoever finds an old message or a leaked link later.
Think in terms of a temporary grant. It belongs to one account, lets the holder do one thing, and has a point at which it stops working. Once you define those properties, you can follow the grant through issuance, delivery, redemption, and cleanup. That gives the team a design it can test, including the parts that happen outside the browser. OWASP forgot password guidance
Decide which event changes the account
The first form accepts an email address and acknowledges the request. Opening that form, filling it in, and clicking Send can all happen without the account holder’s involvement. Leave the current password and sessions alone at this stage. Otherwise someone could repeatedly send reset requests to interrupt a person who is using the app.
The meaningful change comes later, when the server receives a valid grant and accepts a new password. The grant proves control of the designated recovery channel at the time of use. The service should check its purpose and validity before it changes anything. Design the confirmation screen around that event. A message that says “your password has been changed” should reflect a committed change, even when the email delivery system is slow or down.
An email address can point at an account whose sign-in policy does not allow local passwords. A workspace might require its own identity provider, for example. Decide early which accounts can use local recovery, which must use an external provider, and what happens to accounts marked inactive. If a recovery feature can create a new way to sign in for an account that previously followed a more restrictive policy, the recovery feature has changed the organization’s authentication policy.
It helps to draw the flow in five verbs. Request, issue, deliver, redeem, notify. Attach a question to each one. Who can make a request? When may the server issue a grant? Where does delivery go? What exactly can redemption change? Who should know after it succeeds? You can review the flow with support and engineering before the first template lands.
Keep the first response consistent
An anonymous caller should get a useful reply whether the email they entered belongs to a recoverable account or not. Something like “If that address can receive a reset link, we’ll send one” tells the person what to do next without publishing an account directory one form submission at a time.
Check what the person can observe beyond the sentence on screen. The response status, redirect, and time to complete can vary even when the text matches. A design that queues delivery work can keep the initial response separate from mail provider timing. Measure the user-visible path with synthetic accounts. Aim for consistent enough handling that an observer cannot easily distinguish branches from response behavior.
Normalize input to match your sign-in rules. The email address should be handled consistently across login, account creation, and recovery. If your product permits multiple identities or different domains, avoid importing assumptions from one provider into a global normalization rule. Your job is to identify the account according to the rules you already use everywhere else.
Use rate limits around requests and delivery. A single caller should not be able to fill someone else’s mailbox with reset messages. A person sharing a network with many others should still have a reasonable chance of completing recovery. Consider limits by account or normalized destination and by caller context, then use safe operational metrics to see how those limits affect people. Short-term throttling should never hand anonymous callers a reliable way to lock users out of their accounts.
Make a grant the database can reason about
Use a value from a cryptographically secure random generator for an email-based reset token. Decide how long it is valid and store enough information to identify the account, its purpose, and whether it has been used. Store a digest of a high-entropy token where your design permits it. That way a database record about a reset grant doesn’t also contain the usable secret.
Make expiry enforceable at redemption. Cleanup can delete old entries later, but a delayed cleanup job should never stretch the time an old link works. Check the grant’s state in the code that accepts the new password. Include account eligibility if that can change between issuance and use.
Decide what to do if people request several links. Some products replace the earlier grant. Others allow more than one outstanding grant and invalidate the rest once one succeeds. Write down the behavior and explain it in the product when people need it. An email can arrive out of order. If only the latest link works, the text on an expired-link page can help the person use the newest message or request another link.
Use a single authoritative rule for when a grant is consumed. Double clicks, two browser tabs, and network retries are all normal. If two requests arrive together, only one should be able to use the same grant to change the password. Updating the password and consuming the grant in the same transaction is one way to make the outcome clear. Test the failure case too. If the update fails before it commits, decide whether the person can try again with the same grant or needs a new one, then make that behavior consistent.
Keep delivery boring
Send recovery instructions to the channel your account already trusts for that purpose. Construct the reset URL from configuration for the app’s trusted public origin. Include enough information in the message for people to recognize the account and understand what they requested. Keep the subject and body familiar and free of sensitive details.
A reset message is a bearer of temporary power. Think about where that secret goes after it leaves the app. The message might pass through a mail provider, a link rewriting service, a security scanner, and more than one browser. Analytics and error reporting can also record URLs if nobody tells them which pages need special handling. Keep reset pages free of unnecessary third-party requests and keep tokens out of logs and monitoring events. Consider a restrictive referrer policy so browsers do not pass the reset URL along when leaving the page. OWASP forgot password guidance
It’s common for email clients and security tools to open links before the person does. Design the initial load to display the reset form or begin a protected session. Reserve the password change and final grant consumption for an explicit submission. That saves support calls when a protected corporate mailbox visits the link a few seconds after delivery.
Where accounts can receive messages in multiple languages, use the account’s existing language preference if you can do so without changing the anonymous response. The recipient should see a clear link, an expiration expectation, and a sentence explaining how to proceed if they did not request a reset. Give them a standard way to find support from the product itself.
Decide which sessions survive
Once the password changes, determine what happens to existing sessions. Some providers terminate them. Others offer a choice, depending on the nature of the recovery and the account. The service should make a deliberate decision, especially if one reason for using recovery is concern that someone else can already sign in.
Consider what “session” means in your product. A browser cookie, a mobile refresh token, and a long-lived integration credential may have separate lifetime rules. An organization could depend on an integration that has its own credentials and owner. Decide which credentials represent the recovering user, which belong to an organization, and which require a separate review. Tell users what they can expect to happen after the reset.
Keep multifactor recovery separate. A forgotten password and a lost second factor are different problems with different evidence. A password reset should preserve the account’s existing multifactor requirements. If your product supports backup codes, administrator recovery, or identity verification, document each flow and assign it its own permission checks. Treat “I lost my phone and my password” as a case to plan before somebody on a support shift is asked to improvise.
Redirect a completed recovery to the normal sign-in flow unless your product has a specific reason to establish a session. Sending the user through the normal sign-in sequence helps the app apply the same multifactor and organization policy that it applies everywhere else. Keep the path obvious so the person can get back to the invoice or task they started with.
Send a notice after the change commits
A password-change notice helps an account holder recognize a change they didn’t expect. Send it after the account change succeeds. Keep it plain and include a way to reach support through a known route. Never send the new password in the notification.
Think about delivery failure independently of the password update. A temporary email outage shouldn’t undo a committed change. If you use a background job to send the notice, let it retry without changing the password again. Record enough information to tell support whether the account update happened and whether the notice was sent.
What if the user never asked for recovery and gets a request email? That email should explain that the request alone leaves the account unchanged. What if they get a completed-change notice? That needs a different instruction because the account state is different. Give support a clear distinction between those cases in its procedures, too.
A support operator will sometimes want to help by opening the user’s reset link. Give staff a way to confirm delivery state without seeing or redeeming a secret. If there is a separate assisted recovery workflow, give it a clear policy and its own audit trail. A person with access to delivery logs shouldn’t inherit the ability to sign in as customers.
Test with the problems users bring you
Start with a person who can request a link, open it, and set a new password. Confirm the sign-in flow accepts the new password and applies the same second-factor policy as before. Then check the surrounding cases where bugs usually hide.
Use synthetic accounts to test the response for a valid address, a missing address, and an ineligible account. Check that the visible results are consistent. Open the same link twice after a successful submission and confirm the second attempt leaves the account unchanged. Open a link after expiry. Request multiple links, switch between them, and check that the outcome matches the product’s stated behavior.
Change the account’s status while a reset is outstanding. Maybe the organization changes the sign-in method or the account is disabled. The grant should still be bound to its original purpose and should fail when the account no longer meets the recovery policy. Add a test for two submissions that arrive close together so the one-time guarantee is tested where it matters.
Include tests for message delivery. Capture mail in a test inbox, confirm the origin of the URL, and examine what the email contains. Trigger the link’s initial load without submitting a new password. Confirm the account still has the same credentials and that a person can subsequently finish recovery.
Look at what your services logged. Search test logs for a recognizable token value or the new password. A successful test says little about confidentiality if the same run handed the grant to every system in the request path. Keep the tests safe to run without sending real recovery mail or changing anyone’s accounts.
Give operators evidence they can use
Track counts of requests, queued messages, delivery outcomes, and completed resets. Look for abrupt changes after a deployment. A jump in requests followed by a drop in completion might mean email is delayed, the link origin changed, or a page has an accessibility problem. Separate those stages so you can tell what changed.
Use reason codes for private diagnosis. “Grant expired” and “account requires organization sign-in” are useful to distinguish inside the service. Keep the anonymous response general where revealing the difference would expose account details. Restrict log access and retention in line with the data the events contain.
Build a report around what the person is trying to do. If someone says the link doesn’t work, support should be able to confirm whether the service sent a message, whether delivery is delayed, and what the normal next step is. They should have a clear route for cases where the person no longer controls the recovery channel. The normal reset form can’t prove anything about an email inbox the customer lost months ago.
If the mail provider is down, decide how long pending deliveries should wait. An email with a grant that expires before delivery is frustrating and can lead to several follow-up requests. A delivery worker can abandon expired grants and tell operators about the delay. Think through whether recovery messages should expire from the queue as well as from the database.
Make the recovery story short enough to repeat
The flow is easy to explain once the decisions are explicit. Someone asks for help. The app sends a temporary grant through a channel the account already trusts. The server checks that the grant can still be used, accepts a new password once, and sends notice after the change. Then the person signs in under the same account policy they had before.
Use that explanation in code review. When someone adds a new option or puts a new service in the flow, ask which part of the story it touches. If a change introduces a way to find accounts, extends how long a grant works, or changes the account before redemption, make that decision visible before the release. The feature should remain explainable when a tired customer is trying to get back to their invoice.
Separate recovery from a request to change the recovery address
A support team will eventually hear from a customer whose old inbox no longer works. The customer may know their previous password or have a copy of a past invoice, but the normal password reset flow depends on access to the inbox. Give that case its own process with evidence and decision-making authority appropriate to the account. A rep who can trigger a reset email should not necessarily be able to redirect where that email goes.
Treat changing a recovery address as its own security event when the customer is signed in, too. Ask what evidence your account policy needs before replacing a trusted channel. Consider whether to notify the old channel and whether a recent change affects other sensitive actions. If an organization owns the account, its administrator might be responsible for the email identity rather than the person currently signed in.
Write the support instructions for the uncomfortable case. The person requesting help is frustrated, their invoice is due, and somebody wants to accept a shortcut. Make clear which evidence support can request, where they can verify it, and who can authorize an exception. Give support a way to escalate without asking for passwords or forwarding private screenshots through unrelated systems.
Check that the recovery form works under pressure
Try the interface with keyboard navigation and a screen reader. A person who has just lost access to a service is unlikely to spend much time deciphering an error that only appears as a color change. Give the email field a clear name. Put validation where the person can find it, and announce the response when the request completes. The response should make sense for someone who started recovery from a phone and will finish it on a laptop.
Do the same with the form that sets the password. Show the password requirements early enough that people can use them. Allow ordinary paste and autofill behavior so password managers can do their job. Preserve the relevant guidance when validation fails. If the grant has expired, give people a short path back to the request form without making them guess whether the service changed the password.
Think about partial failures from the user’s side. The browser might lose its connection after the service accepts the new password. The person could see a failure message even though the update committed. A retry can safely report that the grant is already used, then point to normal sign-in and a fresh reset if necessary. The product can explain the next action without attempting the same account change a second time.
Keep a plain-language test alongside the engineering checks. Hand a colleague a synthetic account and tell them they’ve forgotten the password. Observe where they hesitate. Their questions can tell you which part of the flow needs clearer words or a better default. The goal is to help them regain access while every service still honors the scope of the recovery grant.
A recovery launch also needs a way to pause delivery while the team investigates a problem. Decide who can do that and what help remains available when email delivery stops. If you have several tenants, determine whether the pause applies to one or all of them. Rehearse resuming service with a synthetic account. Confirm that pending mail follows the expiry policy and that normal sign-in still works. Those checks give the person on call a clear way to limit disruption while protecting account access.
Action checklist
- Return the same public response for eligible and ineligible accounts.
- Set an expiry for each single-use recovery grant.
- Keep reset tokens out of logs and analytics.
- Require explicit submission before changing the password.
- Test expired grants, concurrent submissions, and repeated link visits.
- Check session handling and send a notice after the change commits.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.