ChangePassword through Rest api

Is it possible to change a user password through frappe api?

You can trigger a password reset email like this:

GET /api/method/frappe.core.doctype.user.user.reset_password?
1 Like

yes i was aware of reset-password but i need a change_password api which is available in My settings->change password

Unfortunately the update password method is not white-listed. But you can create a white-list wrapper method for that

This works for changing the password from the command line:

curl --location --request PUT '' \
--header 'Content-Type: application/json' \
--data-raw '{
    "new_password": "My new password"

Or, if you’re using FrappeClient:

from frappeclient import FrappeClient

conn = FrappeClient("")
conn.login("", "password")

doc = conn.get_doc('User', '')
doc['new_password'] = 'My new password'

Keep in mind that it’s not a good idea to set passwords on behalf of your users, or handle passwords at all, if you don’t have to.

Thanks @rmeyer worked like a charm