-
Notifications
You must be signed in to change notification settings - Fork 9
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
#167706805 Enables an Already Logged In User To Change Their Password #35
Conversation
af996cb
to
1d1063d
Compare
1d1063d
to
c18a397
Compare
c18a397
to
716052f
Compare
653d912
to
193c038
Compare
193c038
to
f69ad60
Compare
* @param {Object} res express response object | ||
* @returns {JSON} JSON object with details of new user | ||
*/ | ||
static async changePassword(req, res) { |
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.
where is the check to ensure password
and confirm_password
match?
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.
it was handled in the middleware server/middlewares/passwordValidation.js
server/routes/user.js
Outdated
|
||
route.post('/create', validateUserSignup, Users.create); | ||
route.get('/verifyEmail/:token', verifyToken, Users.verifyUserEmail); | ||
|
||
route.patch( | ||
'/changepassword', |
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.
why lower P
?
server/docs/authors-haven-api.yml
Outdated
@@ -364,6 +364,34 @@ paths: | |||
description: Success. Email verification was successful | |||
500: | |||
description: Internal server errorcomponents | |||
|
|||
/api/v1/users/changepassword: |
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.
update this
f69ad60
to
46bf460
Compare
server/controllers/Users.js
Outdated
static async changePassword(req, res) { | ||
const { password } = req.body; | ||
const { id } = req.user.dataValues; | ||
await User.update({ password }, { where: { id } }); |
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.
I believe you should hash this password before saving it to the database. This way, when the user tries to login, the bcrypt.compare()
function will be able to do a successful comparison.
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.
yes I have hashed it thanks
46bf460
to
fb4cadf
Compare
fb4cadf
to
ff03d37
Compare
Enables an already logged In user to reset their password [Delivers #167706805]
1823c9f
ff03d37
to
1823c9f
Compare
Enables an already logged In user to reset their password [Delivers #167706805]
What does this PR do?
This PR enables signed-in user to change their password
Description of Task proposed in this pull request?
A user controller responsible for updating the user's password and validations for password
How should this be manually tested (Quality Assurance)?
What are the relevant pivotal tracker stories?
What I have learned working on this feature:
Screenshots: