1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 14:47:29 +00:00

login guard

This commit is contained in:
Austin Huang 2020-08-18 10:38:00 -04:00
parent 4feca45341
commit 7f40fd83eb
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F

View File

@ -68,15 +68,13 @@ public final class Login extends BaseLanguageActivity implements View.OnClickLis
loginBinding.webView.loadUrl("https://instagram.com/"); loginBinding.webView.loadUrl("https://instagram.com/");
} else if (v == loginBinding.cookies) { } else if (v == loginBinding.cookies) {
final String mainCookie = Utils.getCookie(webViewUrl); 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(); Toast.makeText(this, R.string.login_error_loading_cookies, Toast.LENGTH_SHORT).show();
else { else {
Utils.setupCookies(mainCookie); Utils.setupCookies(mainCookie);
settingsHelper.putString(Constants.COOKIE, mainCookie); settingsHelper.putString(Constants.COOKIE, mainCookie);
Toast.makeText(this, R.string.login_success_loading_cookies, Toast.LENGTH_SHORT).show(); Toast.makeText(this, R.string.login_success_loading_cookies, Toast.LENGTH_SHORT).show();
Intent intent = new Intent(getApplicationContext(), Main.class); finish();
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
} }
} }
} }