Changing the User Password

A user can change the password by executing the updatePassword method with the current and new passwords.

The user needs to be logged in for changing their password. Once the password is changed, the user needs to relogin with the new password.

  • var fromPassword = "myOldPassword";
    var toPassword = "myNewPassword";
    var user = KiiUser.getCurrentUser();
    
    // Change the password.
    user.updatePassword(fromPassword, toPassword).then(
      function(theUser) {
        // Do something.
      }
    ).catch(
      function(error) {
        // Handle the error.
        var theUser = error.target;
        var errorString = error.message;
      }
    );
  • var fromPassword = "myOldPassword";
    var toPassword = "myNewPassword";
    var user = KiiUser.getCurrentUser();
    
    // Change the password.
    user.updatePassword(fromPassword, toPassword, {
      success: function(theUser) {
        // Do something.
      },
      failure: function(theUser, errorString) {
        // Handle the error.
      }
    });