From 7f40fd83eb05389dc7ba0bd6fbd7bfbc8bd91dac Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Tue, 18 Aug 2020 10:38:00 -0400 Subject: [PATCH] login guard --- app/src/main/java/awais/instagrabber/activities/Login.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/activities/Login.java b/app/src/main/java/awais/instagrabber/activities/Login.java index edc4c1c8..ed5b7b4d 100755 --- a/app/src/main/java/awais/instagrabber/activities/Login.java +++ b/app/src/main/java/awais/instagrabber/activities/Login.java @@ -68,15 +68,13 @@ public final class Login extends BaseLanguageActivity implements View.OnClickLis loginBinding.webView.loadUrl("https://instagram.com/"); } else if (v == loginBinding.cookies) { final String mainCookie = Utils.getCookie(webViewUrl); - if (Utils.isEmpty(mainCookie)) + if (Utils.isEmpty(mainCookie) || !mainCookie.contains("; ds_user_id=")) Toast.makeText(this, R.string.login_error_loading_cookies, Toast.LENGTH_SHORT).show(); else { Utils.setupCookies(mainCookie); settingsHelper.putString(Constants.COOKIE, mainCookie); Toast.makeText(this, R.string.login_success_loading_cookies, Toast.LENGTH_SHORT).show(); - Intent intent = new Intent(getApplicationContext(), Main.class); - intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - startActivity(intent); + finish(); } } }