-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New API endpoint to change the users' password #619
New API endpoint to change the users' password #619
Conversation
This only adds the enpoint which alwyas returns a 404 response.
TODO: - Validate new password. - Extract duplicate code for pass validation. - Tests
for password validation and hashing.
This is an extra security check. Before changing the password the user must provide the current one.
a390cf7
to
95e5019
Compare
ACK 95e5019 |
9e87ed5 feat: [#468] allow users to change the password (Jose Celano) Pull request description: Depends on: - torrust/torrust-index-api-lib#45 - torrust/torrust-index#619 Allow users to change their passwords. ACKs for top commit: josecelano: ACK 9e87ed5 Tree-SHA512: f461ae95d2719e4d95ea1959383f9be8818e5ddcf6e5619fa11d668ca13c82f12f1852ad8369f3484c7360d0fb1b4be5db4c2d15a237af80443dea7fa1867e8f
@@ -65,7 +65,7 @@ impl Service { | |||
.await | |||
.map_err(|_| ServiceError::InternalServerError)?; | |||
|
|||
verify_password(password.as_bytes(), &user_authentication)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just out of curiosity, why are you wrapping the ServiceError::InvalidPassword
to a ServiceError:WrongPasswordOrUsername
. Is it because you want to have the Invalid password
error info in the validate_password function and then return a more generic error to the caller?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @josecelano, In the "change password" form, I want to inform the user that the current password is not valid. However, in the "login form," I don't want to reveal why the login failed, whether it was because of a wrong email or password. If we returned the "invalid password," people could use the login form to find out if a given email/username is registered in the application.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
New API endpoint to change the users' password.