confirmForgotPass method

Future<void> confirmForgotPass(
  1. String userName,
  2. String password,
  3. String verificationCode
)

Handles forgotten password request.

Takes the user that initiated the request, their new password, and the verification code that was sent to their email.

Implementation

Future<void> confirmForgotPass(
    String userName, String password, String verificationCode) async {
  final uri = _urlBase.getPath(_forgotPasswordEndpoint);

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

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