1

I am using the Services module configured with a REST endpoint. I can update all other fields on the user account but when I attempt to update the mail field (user e-mail field) it doesn't appear to change.

I think this has to do with the "current_pass" field. Am I supposed to validate the password somehow?

I am testing this but any "hey, silly guy, did you try this?" would be helpful.

1 Answer 1

1

Way 1:

Yes, you need to send the current password to update the user email that is default Drupal user account configuration, and the default user update enpoint exposed by services programmtically submit the same user profile form, which triggers all the validation your form has. In order to send the current password your request load may look like

{
    "current_pass": "onso",
    "mail": "[email protected]"
}

Way 2:

If you don't want to provide current password, you can consider using No Current Password module, but remember that it will remove the current password field from the form UI as well.

Way 3:

Expose custom endpoint to update user email. Make sure you have authentication on your endpoint.

1
  • Thanks! I just needed someone to tell me that I wasn't entirely crazy. For the options above, making sure to pass the tokens is definitely the way to go. Removing the password confirmation is an option but not terribly secure if the e-mail is intercepted. But the third option, I haven't tried. It is good idea to test. Commented Sep 28, 2016 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.