Skip to content

Add password reset via email #14232

Closed
Closed

Description

@stirby

We allow administrators to reset a user's password via the CLI by connecting directly to the database (#1380). Otherwise, users may change their password in their account settings.

As a user, when I forget my password, I would like to reset it autonomously. This flow is facilitated in most products through a reset password link delivered to the user's email. We can implement the same flow using the new system-generated notifications.

When SMTP notifications are configured for a deployment, a new option would appear on the login page:

Screenshot 2024-08-13 at 4 29 15 PM

They'd then receive an email containing a link to create a new password.

Note

This would introduce a security vulnerability for teams, so admins should be able to disable the feature for their deployment or organization (once merged).

Activity

  1. DanielleMaywood commented on Sep 23, 2024

    @DanielleMaywood
    Collaborator

    Proposal for how this would look:

    • User clicks "Forgot password?"
    • User is presented with a screen that asks for their email
    • User enters the email of their account
      • A one-time-passcode is sent to their email (with a short expiry)
      • User is presented with a field for the one-time-passcode
      • Show message in the UI such as "A one-time-passcode has been sent to your email if the provided email is valid"
        • We shouldn't have a different message if the email is valid or not to prevent enumeration attacks
    • User enters one-time-passcode
      • All existing sessions are logged out
    • User is logged into account
    • User is presented with a mandatory reset password screen

    The decision to send a one-time-passcode to the users email over sending a password reset link is that many places advise against clicking links in emails as it makes people more susceptible to phishing attacks. This flow doesn't pose the same risk as the user never has to click a link from their email.

    @stirby thoughts on this approach?

  2. stirby commented on Sep 24, 2024

    @stirby
    CollaboratorAuthor

    This is exactly as I imagined, except:

    The decision to send a one-time-passcode to the users email over sending a password reset link is that many places advise against clicking links in emails as it makes people more susceptible to phishing attacks.

    But your rationale is very thoughtful. Let's do it.

  3. DanielleMaywood commented on Sep 27, 2024

    @DanielleMaywood
    Collaborator

    After a discussion with @johnstcn and @mafredri we have come up with a slightly simplified flow.

    Rather than these final 3 steps as originally presented:

    • User enters one-time-passcode
      • All existing sessions are logged out
    • User is logged into account
    • User is presented with a mandatory reset password screen

    We'd instead do this:

    • User enters one-time-passcode and new password (with a confirmation field).
      • All existing sessions are logged out.
      • User is logged in.

    This removes an extra step from the flow.

    How does this sound to you @stirby?

  4. stirby commented on Sep 27, 2024

    @stirby
    CollaboratorAuthor

    Yes, all for simplification @DanielleMaywood.

    One more question: do we hide the button when

    • User sign-in is not simple (password)
    • SMTP is not configured
  5. DanielleMaywood commented on Sep 27, 2024

    @DanielleMaywood
    Collaborator

    For both it will be hidden.

    • If password sign-in isn't enabled, then the button would be misleading.
    • If SMTP is not configured, then we cannot send the email with the code, making the feature useless.
  6. mtojek commented on Oct 4, 2024

    @mtojek
    Member

    @BrunoQuaresma Heads-up, this issue will require frontend work 👍 @DanielleMaywood will share details.

  7. chrifro commented on Oct 15, 2024

    @chrifro
    Collaborator

    To help with the UI, I created mockups based on the existing design and the described user flow. Note: the mockups are not pixel-perfect as they are partially based on screenshots
    See Figma

    Image
    Image
    Image
    Image

    Over to you @BrunoQuaresma 🏀

  8. johnstcn commented on Oct 17, 2024

    @johnstcn
    Member

    Thought: we should probably add a more aggressive rate-limit to the "request password reset" endpoint. I think once per minute should be more than sufficient.
    Example: https://github.com/coder/coder/blob/main/coderd/coderd.go#L986-L991

  9. BrunoQuaresma commented on Oct 18, 2024

    @BrunoQuaresma
    Contributor

    Closed by #15108

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enterpriseEnterprise-license / premium functionality

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions