resetPassword method

Future<Response> resetPassword({
  1. bool isMerchant = false,
  2. required String newPassword,
  3. required String confirmPassword,
  4. required String userName,
  5. required String otp,
})

To reset user password in whitelabel app user needs to use below API

Implementation

Future<http.Response> resetPassword({
  bool isMerchant = false,
  required String newPassword,
  required String confirmPassword,
  required String userName,
  required String otp,
}) async {
  Uri url;
  if (isMerchant) {
    url = Uri.parse("$_baseUrl/user/merchant/reset-password/");
  } else {
    url = Uri.parse("$_baseUrl/user/reset-password/");
  }

  final body = jsonEncode({
    "new_password": newPassword,
    "confirm_password": confirmPassword,
    "otp": otp,
    "username": userName,
    "business": SharedPreference.getBusinessConfig()!.businessId,
  });

  http.Response response =
      await http.Client().post(url, body: body, headers: kPostRequestHeader);

  if (response.statusCode == 200) {
    printMessage("RESET PASSWORD RESPONSE = ${response.body}");
    return response;
  } else {
    printMessage("RESET PASSWORD RESPONSE = ${response.statusCode}");
    printMessage("RESET PASSWORD RESPONSE = ${response.body}");
    return response;
  }
}