forgotPassword method

Future<void> forgotPassword(
  1. String account,
  2. ForgotPasswordRequest forgotPasswordRequest
)

Forgot password

Request a password reset for a user. When the user does not already have a password, they will be invited to set a password. This will send an email to the user, if it is a valid email address that exists in our system. The email will contain a link leading to a password reset form securely hosted by Keygen. To send a customized email, see below. 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. Passwordless users are considered "managed" users, and depending on whether or not the account is protected, they may not have permission to set a password. To work around this, you may do one of the following: - Set a temporary password on the user. You can do this when creating the user, or you can do this after the fact. Once a password has been set, the user is no longer considered "managed" and may reset their password normally. - Set the account to unprotected. Though note what this entails — you may want to set all policies to protected to ensure certain actions can't be taken by users, such as license creation. In most cases, we recommend #1.

Parameters:

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

  • ForgotPasswordRequest forgotPasswordRequest (required):

Implementation

Future<void> forgotPassword(String account, ForgotPasswordRequest forgotPasswordRequest,) async {
  final response = await forgotPasswordWithHttpInfo(account, forgotPasswordRequest,);
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
}