resetUserPassword method

Future<ResetUserPasswordResponse?> resetUserPassword(
  1. String account,
  2. String user,
  3. ResetUserPasswordRequest resetUserPasswordRequest
)

Reset password

Fulfill a user's password reset request. Password reset tokens expire 24 hours after requesting the reset. For an example of self-hosting your password reset flow, please see this repo. Alternatively, you can use our Zapier integration. When the account is protected, and the user does not yet have a password set, they will not be able to set their initial password. Only admins may set the password for a passwordless user, unless the account is unprotected.

Parameters:

  • String account (required): The identifier (UUID) or slug of your Keygen account.

  • String user (required): The identifier (UUID) or email of the user to be retrieved.

  • ResetUserPasswordRequest resetUserPasswordRequest (required):

Implementation

Future<ResetUserPasswordResponse?> resetUserPassword(String account, String user, ResetUserPasswordRequest resetUserPasswordRequest,) async {
  final response = await resetUserPasswordWithHttpInfo(account, user, resetUserPasswordRequest,);
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ResetUserPasswordResponse',) as ResetUserPasswordResponse;

  }
  return null;
}