Api.changePassword

changePassword(currentPassword, newPassword)

Changes the password of the session user.

This method executes asynchronously and returns a promise.

Arguments:
  • currentPassword (string) – The current password in clear text.

  • newPassword (string) – The new password in clear text that will take effect once the authentication using the old password has succeeded.

Returns:

For error responses, see Error Responses. If the call succeeds, it returns the following data:

  • User (user) - details of the current account and its privileges. This is cached in Api.User.

  • Branch (branch) - details of the branch the current user is associated with (or null). This is cached in Api.Branch.

  • Config (configuration) - the instance of Config that represents data about the current session and connected TrustID Cloud capabilities. This is cached in Api.Config.

Example response

var api = new TVS.Api();
api.login('admin', 'password').then(function() {
   // ...logged in...now change password...
   return api.changePassword('password', 'newPassword');
}(function(response) {
   return api.getCustomFields();
}).then(function(customFields) {
   console.log('custom fields that are supported:', customFields);
});

For error responses, see Error Responses.