Author: thomas.heute(a)jboss.com
Date: 2008-04-02 10:33:05 -0400 (Wed, 02 Apr 2008)
New Revision: 10482
Modified:
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityConstants.java
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/RegistrationServiceImpl.java
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java
branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity.properties
Log:
JBPORTAL-1974: User management portlet doesn't check if user was created sucessfully
(Partially resolved, still need to solve what happens when the user gets created after a
business process, see: org.jboss.portal.core.identity.jbpm.CreateUserAction)
Modified:
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityConstants.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityConstants.java 2008-04-02
12:19:06 UTC (rev 10481)
+++
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityConstants.java 2008-04-02
14:33:05 UTC (rev 10482)
@@ -60,6 +60,7 @@
/** Registration and validation status */
public static final String REGISTRATION_REGISTERED = "registered";
+ public static final String REGISTRATION_FAILED = "failed";
public static final String REGISTRATION_PENDING = "registration_pending";
public static final String VALIDATION_FAILED = "validation_failed";
public static final String VALIDATION_VALIDATED = "validated";
Modified:
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/RegistrationServiceImpl.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/RegistrationServiceImpl.java 2008-04-02
12:19:06 UTC (rev 10481)
+++
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/RegistrationServiceImpl.java 2008-04-02
14:33:05 UTC (rev 10482)
@@ -160,8 +160,16 @@
||
IdentityConstants.SUBSCRIPTION_MODE_AUTOMATIC.equals(adminSubscriptionMode))
{
// Admin - automatic subscription
- this.getIdentityUserManagementService().createUser(username, password,
profileMap, roles);
- return IdentityConstants.REGISTRATION_REGISTERED;
+
+ boolean success =
this.getIdentityUserManagementService().createUser(username, password, profileMap,
roles);
+ if (success)
+ {
+ return IdentityConstants.REGISTRATION_REGISTERED;
+ }
+ else
+ {
+ return IdentityConstants.REGISTRATION_FAILED;
+ }
}
else
{
@@ -176,8 +184,15 @@
if (subscriptionMode == null ||
IdentityConstants.SUBSCRIPTION_MODE_AUTOMATIC.equals(subscriptionMode))
{
// User - automatic subscription
- this.getIdentityUserManagementService().createUser(username, password,
profileMap, roles);
- return IdentityConstants.REGISTRATION_REGISTERED;
+ boolean success =
this.getIdentityUserManagementService().createUser(username, password, profileMap,
roles);
+ if (success)
+ {
+ return IdentityConstants.REGISTRATION_REGISTERED;
+ }
+ else
+ {
+ return IdentityConstants.REGISTRATION_FAILED;
+ }
}
else
{
Modified:
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java 2008-04-02
12:19:06 UTC (rev 10481)
+++
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java 2008-04-02
14:33:05 UTC (rev 10482)
@@ -30,6 +30,7 @@
import java.util.ResourceBundle;
import javax.faces.application.FacesMessage;
+import javax.faces.application.FacesMessage.Severity;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
@@ -141,7 +142,7 @@
public void register(ActionEvent ev)
{
- String registrationStatus = "failed";
+ String registrationStatus = IdentityConstants.REGISTRATION_FAILED;
FacesContext ctx = FacesContext.getCurrentInstance();
String adminSubscription = (String) ev.getComponent().getId();
ResourceBundle bundle = ResourceBundle.getBundle("conf.bundles.Identity",
ctx.getViewRoot().getLocale());
@@ -205,10 +206,14 @@
{
FacesContext.getCurrentInstance().addMessage(null, new
FacesMessage(bundle.getString("IDENTITY_REGISTER_SUCCESS_TITLE")));
}
- else if (adminSubscription.equals("admin"))
+ else if (adminSubscription.equals("admin") &&
!registrationStatus.equals(IdentityConstants.REGISTRATION_FAILED))
{
FacesContext.getCurrentInstance().addMessage(null, new
FacesMessage(bundle.getString("IDENTITY_MANAGEMENT_CREATE_USER_CREATED")));
}
+ else if (registrationStatus.equals(IdentityConstants.REGISTRATION_FAILED))
+ {
+ FacesContext.getCurrentInstance().addMessage(null, new
FacesMessage(FacesMessage.SEVERITY_ERROR,
bundle.getString("IDENTITY_REGISTER_FAILED"),
bundle.getString("IDENTITY_REGISTER_FAILED")));
+ }
else
{
FacesContext.getCurrentInstance().addMessage(null, new
FacesMessage(bundle.getString("IDENTITY_VALIDATION_ERROR_REGISTRATION")));
Modified:
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java 2008-04-02
12:19:06 UTC (rev 10481)
+++
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java 2008-04-02
14:33:05 UTC (rev 10482)
@@ -89,7 +89,7 @@
catch (IdentityException e)
{
log.error("Error validation username", e);
- throw new ValidatorException(new
FacesMessage(bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_ERROR")));
+ throw new ValidatorException(new
FacesMessage(bundle.getString("IDENTITY_SERVER_ERROR")));
}
catch (CoreIdentityConfigurationException e)
{
Modified:
branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity.properties
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity.properties 2008-04-02
12:19:06 UTC (rev 10481)
+++
branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity.properties 2008-04-02
14:33:05 UTC (rev 10482)
@@ -39,7 +39,10 @@
IDENTITY_REGISTER_SUCCESS_TITLE=Your account has been successfully created. You may want
to login now.
IDENTITY_REGISTER_PENDING_TITLE=An e-mail has been sent to your e-mail address to verify
your registration.
IDENTITY_REGISTER_REQUIRED_INFORMATION=indicates a required field.
+IDENTITY_REGISTER_FAILED=The registration has failed for an unknown reason.
+IDENTITY_SERVER_ERROR=Unexpected identity server error
+
IDENTITY_LOST_PASSWORD_TITLE=Forgot your login data?
IDENTITY_LOST_PASSWORD_DESCRIPTION=Please enter your username to reset your password.
IDENTITY_LOST_PASSWORD_ERROR=Failed to reset password.
Show replies by date