Author: channa
Date: Sun Jan 20 22:05:35 2008
New Revision: 12559
Log:
Added option for primary user to get signed in on registration. (M-527)
Modified:
trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/RegistrationBean.java
trunk/mashup/java/modules/www/register_admin.jsp
Modified:
trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
==============================================================================
--- trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
(original)
+++ trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
Sun Jan 20 22:05:35 2008
@@ -110,6 +110,8 @@
public static final String PRIMARY_USER = "PrimaryUser";
public static final String PRIMARY_PASSWORD = "PrimaryPassword";
public static final String LOCALHOST = "localhost";
+ public static final String TRUE = "true";
+ public static final String SIGNIN = "signin";
public static final int MIN_PASSWORD_LENGTH = 5;
}
Modified:
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/RegistrationBean.java
==============================================================================
---
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/RegistrationBean.java
(original)
+++
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/RegistrationBean.java
Sun Jan 20 22:05:35 2008
@@ -161,10 +161,18 @@
// Create the admin user profile.
RegistryUtils.createUser(registry, realm, userName,
adminName, adminEmail, "System
Administrator");
- // Assign system user the 'admin' role and make primary.
+ // Assign primary user the 'admin' role and make primary.
userStoreAdmin.addUserToRole(userName,
RegistryConstants.ADMIN_ROLE);
RegistryUtils.makeUserPrimary(realm, userName);
MashupUtils.setInitialSetupComplete(true);
+
+ // Log user in as primary if option has been chosen.
+ if
(MashupConstants.TRUE.equals(request.getParameter(MashupConstants.SIGNIN))) {
+ SecureRegistry secureRegistry =
+ RegistryUtils.createSecureRegistry(userName, password,
+ jdbcRegistry,
realm);
+
request.getSession().setAttribute(MashupConstants.USER_REGISTRY,
secureRegistry);
+ }
} catch (UserManagerException e) {
log.error("Error creating admin user in user manager", e);
throw new MashupFault("Could not create admin user", e);
Modified: trunk/mashup/java/modules/www/register_admin.jsp
==============================================================================
--- trunk/mashup/java/modules/www/register_admin.jsp (original)
+++ trunk/mashup/java/modules/www/register_admin.jsp Sun Jan 20 22:05:35 2008
@@ -19,6 +19,7 @@
<%@ page import="org.wso2.mashup.webapp.utils.RegistryUtils" %>
<%@ page import="org.wso2.registry.Registry" %>
<%@ page import="java.util.ResourceBundle" %>
+<%@ page import="org.wso2.mashup.MashupConstants" %>
<%
ResourceBundle bundle = ResourceBundle.getBundle("UI");
@@ -102,6 +103,11 @@
</td>
</tr>
<tr>
+ <td><label><strong>Sign me in
now:</strong></label></td>
+ <td><input type="checkbox" name="<%=
MashupConstants.SIGNIN %>"
+ value="<%= MashupConstants.TRUE
%>"/></td>
+ </tr>
+ <tr>
<td> </td>
<td><input type="submit" value="Create
Account"/></td>
</tr>
_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev