resetPassword method

  1. @override
Future<Verification> resetPassword(
  1. String username
)
override

Initiates a password reset flow for the given username

Implementation

@override
Future<Verification> resetPassword(
  String username,
) async {
  try {
    final result = await _amplifyAuth.resetPassword(
      username: username,
    );
    _logger.fine('Successfully initiated reset password flow: $result');

    return _createVerificationResult(
      VerificationFlow.resetPassword,
      result.nextStep.codeDeliveryDetails,
    );
  } on aws_cognito.LimitExceededException catch (e) {
    throw ResetPasswordLimitException(
      message: e.message,
      innerException: e,
      innerStackTrace: StackTrace.current,
    );
  } on aws_cognito.AuthException catch (e) {
    throw ResetPasswordException(
      message: e.message,
      innerException: e,
      innerStackTrace: StackTrace.current,
    );
  }
}