Skip to content

Add a POST /password/reset endpoint #731

@begedin

Description

@begedin

We need to add a POST /password/reset endpoint as the last step to reset a user's password

  • Takes in [:value, :password, :password_confirmation]
  • Finds AuthToken by :value, as well as associated User
  • Uses [Phoenix.Token.verify/4] to verify the token is correct and not expired or anything like that.
  • If all is in order, updates the user with new password
    • For this, w need a User.reset_password_changeset which casts and validates :password and :password_confirmation. It should ensure the two match before encrypting and assigning the new password. This can be done as a separate issue in Create User.reset_password_changeset/2 #728
    • Endpoint should render validation errors if the changeset is invalid

Subtasks

  • add endpoint to router
  • add PasswordResetController.reset_password
  • past this point, we are blocked by Create User.reset_password_changeset/2 #728
  • ensure endpoint renders 200 OK if reset passes
  • ensure endpoint renders 422 if reset fails due to password mismatch
  • add controller tests

References

Progress on: #498

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions