Improve login success check
This commit is contained in:
parent
936984c71d
commit
4d1e841448
|
@ -32,10 +32,13 @@ public class Cam4HttpClient extends HttpClient {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private boolean checkLoginSuccess() throws IOException {
|
private boolean checkLoginSuccess() throws IOException {
|
||||||
String mailUrl = "https://www.cam4.de.com/mail/unreadThreads";
|
String mailUrl = Cam4.BASE_URI + "/mail/unreadThreads";
|
||||||
Request req = new Request.Builder().url(mailUrl).build();
|
Request req = new Request.Builder()
|
||||||
|
.url(mailUrl)
|
||||||
|
.addHeader("X-Requested-With", "XMLHttpRequest")
|
||||||
|
.build();
|
||||||
Response response = execute(req);
|
Response response = execute(req);
|
||||||
if(response.isSuccessful()) {
|
if(response.isSuccessful() && response.body().contentLength() > 0) {
|
||||||
JSONObject json = new JSONObject(response.body().string());
|
JSONObject json = new JSONObject(response.body().string());
|
||||||
return json.has("status") && Objects.equals("success", json.getString("status"));
|
return json.has("status") && Objects.equals("success", json.getString("status"));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue