summaryrefslogtreecommitdiff
path: root/src/se
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2013-07-09 18:41:47 +0200
committerSean Leonard <meanderingcode@aetherislands.net>2013-07-12 14:27:48 -0600
commit652d0e84785b89ac13c0fc03663ce0e2811aea6b (patch)
tree336d9904bafdd66db350401090b12a6cde5ed885 /src/se
parent8bd4d61319b1418e5fef2d9f932044b07bfc1f20 (diff)
Dashboard menu is updated when logged in or out.
Login option is not shown if the user is already logged in, and logout option is not shown if the user is not logged in. I've also removed a debug line from ProviderDetailFragment, which returned true when it returned false because of an exception.
Diffstat (limited to 'src/se')
-rw-r--r--src/se/leap/leapclient/Dashboard.java16
-rw-r--r--src/se/leap/leapclient/ProviderDetailFragment.java1
2 files changed, 12 insertions, 5 deletions
diff --git a/src/se/leap/leapclient/Dashboard.java b/src/se/leap/leapclient/Dashboard.java
index a330f9e0..a429d3b3 100644
--- a/src/se/leap/leapclient/Dashboard.java
+++ b/src/se/leap/leapclient/Dashboard.java
@@ -57,6 +57,7 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
private TextView eipStatus;
private boolean mEipWait = false;
+ private boolean authed = false;
public ProviderAPIResultReceiver providerAPI_result_receiver;
private EIPReceiver mEIPReceiver;
@@ -234,8 +235,13 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
provider_json = ConfigHelper.getJsonFromSharedPref(ConfigHelper.PROVIDER_KEY);
JSONObject service_description = provider_json.getJSONObject(ConfigHelper.SERVICE_KEY);
if(service_description.getBoolean(ConfigHelper.ALLOW_REGISTRATION_KEY)) {
- menu.findItem(R.id.login_button).setVisible(true);
- menu.findItem(R.id.logout_button).setVisible(true);
+ if(authed) {
+ menu.findItem(R.id.login_button).setVisible(false);
+ menu.findItem(R.id.logout_button).setVisible(true);
+ } else {
+ menu.findItem(R.id.login_button).setVisible(true);
+ menu.findItem(R.id.logout_button).setVisible(false);
+ }
}
} catch (JSONException e) {
// TODO Auto-generated catch block
@@ -384,14 +390,16 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
String session_id_cookie_key = resultData.getString(ConfigHelper.SESSION_ID_COOKIE_KEY);
String session_id_string = resultData.getString(ConfigHelper.SESSION_ID_KEY);
setResult(RESULT_OK);
- mProgressDialog.dismiss();
+ authed = true;
+ invalidateOptionsMenu();
Cookie session_id = new BasicClientCookie(session_id_cookie_key, session_id_string);
downloadAuthedUserCertificate(session_id);
} else if(resultCode == ConfigHelper.SRP_AUTHENTICATION_FAILED) {
logInDialog(getCurrentFocus(), resultData.getString(getResources().getString(R.string.user_message)));
- mProgressDialog.dismiss();
} else if(resultCode == ConfigHelper.LOGOUT_SUCCESSFUL) {
+ authed = false;
+ invalidateOptionsMenu();
setResult(RESULT_OK);
mProgressDialog.dismiss();
} else if(resultCode == ConfigHelper.LOGOUT_FAILED) {
diff --git a/src/se/leap/leapclient/ProviderDetailFragment.java b/src/se/leap/leapclient/ProviderDetailFragment.java
index a788594f..600be58f 100644
--- a/src/se/leap/leapclient/ProviderDetailFragment.java
+++ b/src/se/leap/leapclient/ProviderDetailFragment.java
@@ -43,7 +43,6 @@ public class ProviderDetailFragment extends DialogFragment {
}
if(registration_allowed(provider_json)) {
-
builder.setNegativeButton(R.string.login_button, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
interface_with_configuration_wizard.login();