reqForgotPass method

Future<void> reqForgotPass(
  1. String userName
)

Initiates a forgotten password flow.

Sends password reset email to the userName.

Implementation

Future<void> reqForgotPass(String userName) async {
  final uri = _urlBase.getPath(_forgotPasswordEndpoint);

  final body = await JsonIsolate().encodeJson({
    'user_name': userName,
  });

  final resp = await put(uri, body: body);
  final bodyResp = await JsonIsolate().decodeJson(resp.body);
  if (resp.statusCode != 200) {
    if (bodyResp['error_code'] == 101031) {
      throw FailedPasswordException();
    }
    throw bodyResp['description'];
  }
}