KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to change a user password via a REST API. This is not a forgotten or reset password function, but a logged in user wanting to change their password. The form requires the current password, the new password, and a confirmation for the new password. However, I want to validate each form field as the user fills it out. This is trivial for newPassword and confirmNewPassword (client side), but not for currentPassword . Currently performing update to the User object via PUT /users/:id . If a password parameter is passed, I check for the currentPassword parameter and ensure it is correct prior to saving. However, for validation, I'm unsure of the best approach. I also have a POST /users/validate - not sure if this is best either. This validates a User object for both create and update, but only validates fields that belong to the User object ( email , username , password ). currentPassword isn't one of these. Wondering how to handle this. Some things I've considered: POST /users/check_password , POST /users/validate (adding in validation for currentPassword if that parameter is passed, and check that currentPassword matches the users existing password) and POST /users/:id/validate (separate validation for existing user, requiring currentPassword ). Any thoughts or advice would be greatly appreciated. My first application that only exposes functionality via REST API.
Tags (comma-separated)
Save Edits
Cancel