changePassword method

Future<ClientResponse<ChangePasswordResponse, Errors>> changePassword(
  1. String changePasswordId,
  2. ChangePasswordRequest request
)

Changes a user's password using the change password Id. This usually occurs after an email has been sent to the user and they clicked on a link to reset their password.

As of version 1.32.2, prefer sending the changePasswordId in the request body. To do this, omit the first parameter, and set the value in the request body.

@param {String} changePasswordId The change password Id used to find the user. This value is generated by FusionAuth once the change password workflow has been initiated. @param {ChangePasswordRequest} request The change password request that contains all the information used to change the password. @returns {Promise<ClientResponse

Implementation

Future<ClientResponse<ChangePasswordResponse, Errors>> changePassword(
    String changePasswordId, ChangePasswordRequest request) {
  return _startAnonymous<ChangePasswordResponse, Errors>()
      .withUri('/api/user/change-password')
      .withUriSegment(changePasswordId)
      .withJSONBody(request)
      .withMethod('POST')
      .withResponseHandler(defaultResponseHandlerBuilder(
          (d) => ChangePasswordResponse.fromJson(d)))
      .go();
}