use of forpdateam.ru.forpda.api.auth.models.AuthForm in project ForPDA by RadiationX.
the class Auth method getForm.
public AuthForm getForm() throws Exception {
NetworkResponse response = Api.getWebClient().get(AUTH_BASE_URL);
if (response.getBody() == null || response.getBody().isEmpty())
throw new Exception("Page empty!");
if (checkLogin(response.getBody()))
throw new Exception("You already logged");
AuthForm form = new AuthForm();
Matcher matcher = captchaPattern.matcher(response.getBody());
if (matcher.find()) {
form.setCaptchaTime(matcher.group(1));
form.setCaptchaSig(matcher.group(2));
form.setCaptchaImageUrl(matcher.group(3));
} else {
throw new Exception("Form Not Found");
}
form.setBody(response.getBody());
return form;
}
Aggregations