Author: adietish
Date: 2012-02-14 08:02:26 -0500 (Tue, 14 Feb 2012)
New Revision: 38694
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
Log:
[JBIDE-10893] setting state to invalid credentials if the user is not valid
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2012-02-14
11:34:32 UTC (rev 38693)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2012-02-14
13:02:26 UTC (rev 38694)
@@ -44,6 +44,7 @@
import org.jboss.tools.common.ui.databinding.ParametrizableWizardPageSupport;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
+import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
import org.jboss.tools.openshift.express.internal.ui.utils.UIUtils;
/**
@@ -157,12 +158,11 @@
if (direction == Direction.BACKWARDS) {
return;
}
- if (!pageModel.areCredentialsValid()) {
- event.doit = performAuthentication();
- if (!event.doit) {
- passwordText.setFocus();
- passwordText.selectAll();
- }
+ boolean validCredemtials = performAuthentication();
+ event.doit = validCredemtials;
+ if (!event.doit) {
+ passwordText.setFocus();
+ passwordText.selectAll();
}
}
@@ -183,8 +183,7 @@
Logger.error("Failed to authenticate on OpenShift", e);
return false;
}
- boolean valid = pageModel.areCredentialsValid();
- return valid;
+ return pageModel.areCredentialsValid();
}
class CredentialsInputValidator extends MultiValidator {
@@ -205,7 +204,8 @@
// something..
final String rhLoginValue = (String) rhLoginObservable.getValue();
final String passwordValue = (String) passwordObservable.getValue();
- if (rhLoginValue != null && !rhLoginValue.isEmpty() && passwordValue
!= null && !passwordValue.isEmpty()) {
+ if (!StringUtils.isEmpty(rhLoginValue)
+ && !StringUtils.isEmpty(passwordValue)) {
return ValidationStatus.ok();
}
return ValidationStatus.cancel("Please provide your OpenShift Express user
credentials");
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java 2012-02-14
11:34:32 UTC (rev 38693)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java 2012-02-14
13:02:26 UTC (rev 38694)
@@ -70,7 +70,7 @@
SecurePasswordStore store = null;
final OpenShiftPasswordStorageKey key = new OpenShiftPasswordStorageKey(platform,
username);
if (key != null) {
- store = new SecurePasswordStore(key);
+ store = new SecurePasswordStore(key);
}
return store;
}
@@ -106,11 +106,11 @@
Logger.error(e.getMessage(), e);
}
}
-
+
private void erasePasswordStore() {
try {
if (store != null) {
- store.remove();
+ store.remove();
}
} catch (SecurePasswordStoreException e) {
Logger.error(e.getMessage(), e);
@@ -198,11 +198,13 @@
} else {
erasePasswordStore();
}
+ } else {
+ status = OpenShiftUIActivator.createErrorStatus(
+ NLS.bind("The credentials for user {0} are not valid",
user.getRhlogin()));
+
}
} catch (NotFoundOpenShiftException e) {
// valid user without domain
- } catch (OpenShiftException e) {
- status = OpenShiftUIActivator.createErrorStatus("Your credentails are not
valid.");
} catch (Exception e) {
status = OpenShiftUIActivator.createErrorStatus(NLS.bind(
"Could not check user credentials: {0}.", e.getMessage()));
Show replies by date