Search code examples
javascriptparse-server

Need help clarifying Parse.User.setPassword documentation


I am trying to implement two way to reinitialize a user password in a JS application using Parse.
Since I'll need a way to directly set the password, I searched Parse.User documentation for a function to update the password field, hoping to know if I am supposed to hash it myself, and how I should use it.

Unfortunately, the official documentation is quite unhelpful:

Boolean setPassword( password, options )

Calls set("password", password, options) and returns the result.
Parameters:

password <String>
options <Object>

A Backbone-style options object.

Returns: <Boolean>

What I was expecting to know was if I was supposed to hash the password before providing it, if there is a difference between setPassword and set("password"...), and which options are available.


Solution

  • After trying and testing, I can conclude that:

    • setPassword() is just a shortcur of set('password')
    • The options available are the common ones: useMasterKey, sessionToken...
    • Setting the password automatically hash it.