New API endpoint to change the users' password#619
Merged
josecelano merged 5 commits intotorrust:developfrom Jun 5, 2024
Merged
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
Member
Author
|
ACK 95e5019 |
josecelano
added a commit
to torrust/torrust-index-gui
that referenced
this pull request
Jun 5, 2024
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
mario-nt
reviewed
Jun 6, 2024
| .await | ||
| .map_err(|_| ServiceError::InternalServerError)?; | ||
|
|
||
| verify_password(password.as_bytes(), &user_authentication)?; |
Contributor
There was a problem hiding this comment.
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?
Member
Author
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New API endpoint to change the users' password.