summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/Dashboard.java16
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java6
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/Constants.java1
-rw-r--r--app/src/main/res/values/strings.xml2
4 files changed, 8 insertions, 17 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
index 6d368e11..4fe51939 100644
--- a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
+++ b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
@@ -63,7 +63,6 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
EipFragment eip_fragment;
private Provider provider;
- private static boolean authed_eip;
public ProviderAPIResultReceiver providerAPI_result_receiver;
private boolean switching_provider;
@@ -148,7 +147,6 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
sessionDialog(Bundle.EMPTY);
}
- preferences.edit().putBoolean(Constants.AUTHED_EIP, authed_eip).apply();
} else if (resultCode == RESULT_CANCELED && data.hasExtra(ACTION_QUIT)) {
finish();
} else
@@ -222,12 +220,11 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
if(!provider_json_string.isEmpty()) {
provider_json = new JSONObject(provider_json_string);
JSONObject service_description = provider_json.getJSONObject(Provider.SERVICE);
- boolean authed_eip = !LeapSRPSession.getToken().isEmpty();
boolean allow_registered_eip = service_description.getBoolean(Provider.ALLOW_REGISTRATION);
preferences.edit().putBoolean(Constants.ALLOWED_REGISTERED, allow_registered_eip).apply();
if(allow_registered_eip) {
- if(authed_eip) {
+ if(LeapSRPSession.loggedIn()) {
menu.findItem(R.id.login_button).setVisible(false);
menu.findItem(R.id.logout_button).setVisible(true);
} else {
@@ -265,7 +262,7 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
return true;
case R.id.switch_provider:
switching_provider = true;
- if (preferences.getBoolean(Constants.AUTHED_EIP, false)) logOut();
+ if (LeapSRPSession.loggedIn()) logOut();
else switchProvider();
return true;
case R.id.login_button:
@@ -299,7 +296,7 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
}
protected void downloadVpnCertificate() {
- boolean is_authenticated = !LeapSRPSession.getToken().isEmpty();
+ boolean is_authenticated = LeapSRPSession.loggedIn();
boolean allowed_anon = preferences.getBoolean(Constants.ALLOWED_ANON, false);
if(allowed_anon || is_authenticated)
providerApiCommand(Bundle.EMPTY, R.string.downloading_certificate_message, ProviderAPI.DOWNLOAD_CERTIFICATE);
@@ -373,18 +370,12 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
updateViewHidingProgressBar(resultCode);
sessionDialog(resultData);
} else if(resultCode == ProviderAPI.SUCCESSFUL_LOGIN) {
- authed_eip = true;
- preferences.edit().putBoolean(Constants.AUTHED_EIP, authed_eip).apply();
-
updateViewHidingProgressBar(resultCode);
downloadVpnCertificate();
} else if(resultCode == ProviderAPI.FAILED_LOGIN) {
updateViewHidingProgressBar(resultCode);
sessionDialog(resultData);
} else if(resultCode == ProviderAPI.SUCCESSFUL_LOGOUT) {
- authed_eip = false;
- preferences.edit().putBoolean(Constants.AUTHED_EIP, authed_eip).apply();
-
updateViewHidingProgressBar(resultCode);
if(switching_provider) switchProvider();
} else if(resultCode == ProviderAPI.LOGOUT_FAILED) {
@@ -422,7 +413,6 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
switch(previous_result_code){
case ProviderAPI.SUCCESSFUL_LOGIN: setStatusMessage(R.string.succesful_authentication_message); break;
case ProviderAPI.FAILED_LOGIN: setStatusMessage(R.string.authentication_failed_message); break;
- case ProviderAPI.CORRECTLY_DOWNLOADED_CERTIFICATE: setStatusMessage(R.string.authed_secured_status); break;
case ProviderAPI.INCORRECTLY_DOWNLOADED_CERTIFICATE: setStatusMessage(R.string.incorrectly_downloaded_certificate_message); break;
case ProviderAPI.SUCCESSFUL_LOGOUT: setStatusMessage(R.string.logged_out_message); break;
case ProviderAPI.LOGOUT_FAILED: setStatusMessage(R.string.log_out_failed_message); break;
diff --git a/app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java b/app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java
index 989dc395..09855baf 100644
--- a/app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java
+++ b/app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
- package se.leap.bitmaskclient;
+package se.leap.bitmaskclient;
import org.jboss.security.srp.SRPParameters;
@@ -331,6 +331,10 @@ public class LeapSRPSession {
return token;
}
+ protected static boolean loggedIn() {
+ return !token.isEmpty();
+ }
+
/**
* @return a new SHA-256 digest.
*/
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/Constants.java b/app/src/main/java/se/leap/bitmaskclient/eip/Constants.java
index 12c2e015..f7206927 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/Constants.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/Constants.java
@@ -27,7 +27,6 @@ public interface Constants {
public final static String TAG = Constants.class.getSimpleName();
- public final static String AUTHED_EIP = TAG + ".AUTHED_EIP";
public final static String ACTION_CHECK_CERT_VALIDITY = TAG + ".CHECK_CERT_VALIDITY";
public final static String ACTION_START_EIP = TAG + ".START_EIP";
public final static String ACTION_STOP_EIP = TAG + ".STOP_EIP";
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 1608f487..709d92b5 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -16,8 +16,6 @@
<string name="provider_label">Provider:</string>
<string name="provider_label_none">No provider configured</string>
<string name="status_unknown">Status unknown.</string>
- <string name="anonymous_secured_status">Connection secure using an anonymous certificate.</string>
- <string name="authed_secured_status">Connection secure using your own certificate.</string>
<string name="eip_service_label">Encrypted Internet</string>
<string name="configuration_wizard_title">Select a service provider</string>
<string name="new_provider_button">Add new Provider</string>