Author: emuckenhuber
Date: 2007-08-17 14:22:12 -0400 (Fri, 17 Aug 2007)
New Revision: 7984
Added:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityCommandFactory.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityCommandFactoryService.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityURLFactory.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/SendMailBean.java
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/templates/changeEmail/
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/templates/changeEmail/emailTemplate.tpl
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/templates/lostPassword/
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/templates/lostPassword/emailTemplate.tpl
Removed:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/ValidateEmailServlet.java
Modified:
trunk/core-identity/.classpath
trunk/core-identity/build.xml
trunk/core-identity/src/main/org/jboss/portal/core/identity/test/validators/EmailValidatorTest.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/IdentityConstants.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/UIRole.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/LostPasswordAction.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityUserBean.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/MetaDataServiceBean.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/CurrentPasswordValidator.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/EmailValidator.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/PasswordValidator.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java
trunk/core-identity/src/resources/portal-identity-sar/META-INF/jboss-service.xml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/Identity.properties
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/faces-config.xml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/index.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/registerRoles.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/userTemplate.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/profile.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/lostPassword/lost.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/lostPassword/lostTemplate.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/lostPassword/status.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/register/overview.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/portlet-instances.xml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml
Log:
- added lost password feature
- added enable / disable feature in the admin porlet
Modified: trunk/core-identity/.classpath
===================================================================
--- trunk/core-identity/.classpath 2007-08-17 15:41:47 UTC (rev 7983)
+++ trunk/core-identity/.classpath 2007-08-17 18:22:12 UTC (rev 7984)
@@ -12,7 +12,6 @@
<classpathentry combineaccessrules="false" kind="src"
path="/security"/>
<classpathentry combineaccessrules="false" kind="src"
path="/server"/>
<classpathentry combineaccessrules="false" kind="src"
path="/workflow"/>
- <classpathentry combineaccessrules="false" kind="src"
path="/core-admin"/>
<classpathentry kind="lib"
path="output/resources/portal-identity-war/WEB-INF/lib2/commons-beanutils.jar"/>
<classpathentry kind="lib"
path="output/resources/portal-identity-war/WEB-INF/lib2/commons-digester.jar"/>
<classpathentry kind="lib"
path="output/resources/portal-identity-war/WEB-INF/lib2/commons-el.jar"/>
@@ -30,5 +29,26 @@
<classpathentry kind="lib"
path="/thirdparty/hibernate/lib/hibernate3.jar"/>
<classpathentry kind="con"
path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
<classpathentry kind="lib"
path="/thirdparty/freemarker/lib/freemarker.jar"/>
+ <classpathentry combineaccessrules="false" kind="src"
path="/core-cms"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jboss.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jboss-aspect-library.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jboss-common-client.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jboss-common-jdbc-wrapper.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jbossha.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jboss-hibernate.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jboss-j2ee.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jboss-jaxrpc.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jboss-jca.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jboss-jmx.jar"
sourcepath="/JBoss_AS_4.0.5/jmx/src/main"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jboss-local-jdbc.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jboss-saaj.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jbosssx.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jboss-system.jar"
sourcepath="/JBoss_AS_4.0.5/system/src/main"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jboss-transaction.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jboss-xml-binding.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jmx-invoker-adaptor-client.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jnp-client.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jnpserver.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/namespace.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/core-identity/build.xml
===================================================================
--- trunk/core-identity/build.xml 2007-08-17 15:41:47 UTC (rev 7983)
+++ trunk/core-identity/build.xml 2007-08-17 18:22:12 UTC (rev 7984)
@@ -88,8 +88,8 @@
&libraries;
<path id="library.classpath">
- <path refid="jboss.jbossxb.classpath"/>
- <path refid="jboss.cache.classpath"/>
+ <path refid="jboss.jbossxb.classpath"/>
+ <path refid="jboss.cache.classpath"/>
<path refid="freemarker.freemarker.classpath"/>
<path refid="jbossas/core.libs.classpath"/>
<path refid="hibernate.hibernate.classpath"/>
@@ -188,15 +188,20 @@
<mkdir dir="${build.lib}"/>
- <!-- portal-core-identity-lib.jar -->
- <jar jarfile="${build.lib}/portal-core-identity-lib.jar">
- <fileset dir="${build.classes}"/>
+ <!-- portal-core-identity-ui-lib.jar -->
+ <jar jarfile="${build.lib}/portal-core-identity-ui-lib.jar">
+ <fileset dir="${build.classes}"
includes="org/jboss/portal/core/identity/ui/**" />
</jar>
+
+ <!-- portal-core-identity-services-lib.jar -->
+ <jar
jarfile="${build.lib}/portal-core-identity-services-lib.jar">
+ <fileset dir="${build.classes}"
includes="org/jboss/portal/core/identity/services/**" />
+ </jar>
<!-- portal-identity.war -->
<copy todir="${build.resources}/portal-identity-war/WEB-INF/lib2">
<fileset dir="${apache.myfaces.lib}"
includes="myfaces-api.jar,myfaces-impl.jar,jstl.jar"/>
- <fileset dir="${build.lib}"
includes="portal-core-identity-lib.jar"/>
+ <fileset dir="${build.lib}"
includes="portal-core-identity-ui-lib.jar"/>
<fileset dir="${jboss.portal-faces.root}/lib"
includes="portal-faces-lib.jar"/>
<fileset dir="../core-admin/src/etc/sun-jsf"
includes="jsf-example.jar"/>
<fileset dir="${facelets.facelets.lib}"
includes="jsf-facelets.jar"/>
@@ -213,6 +218,7 @@
<fileset dir="${build.resources}/portal-identity-sar"/>
</copy>
<copy todir="${build.resources}/portal-identity.sar/lib">
+ <fileset dir="${build.lib}"
includes="portal-core-identity-services-lib.jar" />
<fileset dir="${jboss.portal-faces.root}/lib"
includes="portal-faces-loader-lib.jar"/>
</copy>
Added:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityCommandFactory.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityCommandFactory.java
(rev 0)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityCommandFactory.java 2007-08-17
18:22:12 UTC (rev 7984)
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.identity.services;
+
+import org.jboss.portal.core.controller.command.mapper.CommandFactory;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface IdentityCommandFactory extends CommandFactory
+{
+ PortalObjectId getTargetWindowId();
+}
+
Added:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityCommandFactoryService.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityCommandFactoryService.java
(rev 0)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityCommandFactoryService.java 2007-08-17
18:22:12 UTC (rev 7984)
@@ -0,0 +1,180 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.identity.services;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
+import org.jboss.portal.core.identity.ui.IdentityConstants;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.PortalObjectPath;
+import
org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
+import org.jboss.portal.core.ui.portlet.user.UserPortletConstants;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.NoSuchUserException;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.portlet.PortletParametersStateString;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.config.ServerConfig;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class IdentityCommandFactoryService extends AbstractCommandFactory implements
IdentityCommandFactory
+{
+
+ /** . */
+ protected String targetWindowRef = null;
+
+ /** . */
+ protected PortalObjectId targetWindowId;
+
+ /** . */
+ protected ServerConfig serverConfig;
+
+ /** . */
+ protected UserModule userModule;
+
+ /** . */
+ protected UserProfileModule userProfileModule;
+
+ public PortalObjectId getTargetWindowId()
+ {
+ return targetWindowId;
+ }
+
+ public ServerConfig getServerConfig()
+ {
+ return serverConfig;
+ }
+
+ public void setServerConfig(ServerConfig serverConfig)
+ {
+ this.serverConfig = serverConfig;
+ }
+
+ public IdentityCommandFactoryService()
+ {
+ try
+ {
+ // Do something better ?
+ InitialContext ctx = new InitialContext();
+ this.userModule = (UserModule) ctx.lookup("java:/portal/UserModule");
+ this.userProfileModule = (UserProfileModule)
ctx.lookup("java:/portal/UserProfileModule");
+ }
+ catch (NamingException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public ControllerCommand doMapping(ControllerContext controllerContext,
ServerInvocation invocation, String host,
+ String contextPath, String requestPath)
+ {
+ PortletParametersStateString renderParameters = new
PortletParametersStateString();
+ //renderParameters.setValue("action", "editProfile");
+
+ if (requestPath != null)
+ {
+
+ // Remove starting /
+ String rPath = requestPath.trim().substring(1, requestPath.length());
+ String[] aRequest = rPath.split("/");
+ int aLength = aRequest.length;
+
+ // Values: action / userId / hash / default / default /
IdentityUserPorletWindow
+ if (aLength > 5)
+ {
+ // TODO - UTF-8 decode
+ String action = aRequest[0];
+ String username = aRequest[1];
+ String hash = aRequest[2];
+
+ // Building path for targetWindow
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 3; i < aLength; i++)
+ {
+ buffer.append(aRequest[i]);
+ if ((i + 1) != aLength)
+ {
+ buffer.append(".");
+ }
+ }
+
+ // TODO - nice failure
+ this.targetWindowId = PortalObjectId.parse(buffer.toString(),
PortalObjectPath.LEGACY_FORMAT);
+
+ try
+ {
+ User user = this.userModule.findUserByUserName(username);
+ String storedHash = (String) this.userProfileModule.getProperty(user,
IdentityConstants.USER_PROFILE_GENERATED_HASH);
+
+ if ( storedHash.equals(hash))
+ {
+ if (IdentityConstants.VERIFICATION_ACTION_REGISTER.equals(action))
+ {
+ this.userProfileModule.setProperty(user, User.INFO_USER_ENABLED,
Boolean.TRUE);
+ }
+ else if
(IdentityConstants.VERIFICATION_ACTION_UPDATE_EMAIL.equals(action))
+ {
+ String newEmail = (String) this.userProfileModule.getProperty(user,
IdentityConstants.USER_PROFILE_NEW_EMAIL_ADDRESS);
+ this.userProfileModule.setProperty(user, User.INFO_USER_EMAIL_REAL,
newEmail);
+ }
+ }
+ }
+ catch (IllegalArgumentException e)
+ {
+ // FIXME
+ e.printStackTrace();
+ }
+ catch (NoSuchUserException e)
+ {
+ //
+ }
+ catch (IdentityException e)
+ {
+ // FIXME
+ e.printStackTrace();
+ }
+ }
+ else
+ {
+ this.targetWindowId =
PortalObjectId.parse("default.default.wizardWindow_33",
+ PortalObjectPath.LEGACY_FORMAT);
+ }
+
+ }
+ // Perform a render URL on the target window
+ return new InvokePortletWindowRenderCommand(targetWindowId, Mode.VIEW,
WindowState.NORMAL, renderParameters);
+ }
+
+}
Added:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityURLFactory.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityURLFactory.java
(rev 0)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityURLFactory.java 2007-08-17
18:22:12 UTC (rev 7984)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.identity.services;
+
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.command.mapper.URLFactoryDelegate;
+import org.jboss.portal.server.AbstractServerURL;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerURL;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class IdentityURLFactory extends URLFactoryDelegate
+{
+
+ /** . */
+ private String path;
+
+ public String getPath()
+ {
+ return path;
+ }
+
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+
+ public ServerURL doMapping(ControllerContext controllerContext, ServerInvocation
invocation, ControllerCommand cmd)
+ {
+ if (cmd == null)
+ {
+ throw new IllegalArgumentException("No null command accepted");
+ }
+ AbstractServerURL abstractServerURL = new AbstractServerURL();
+ abstractServerURL.setPortalRequestPath(path);
+ return abstractServerURL;
+ }
+
+}
+
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/test/validators/EmailValidatorTest.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/test/validators/EmailValidatorTest.java 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/test/validators/EmailValidatorTest.java 2007-08-17
18:22:12 UTC (rev 7984)
@@ -45,7 +45,6 @@
{
fail("12.blah(a)foo.com should be valid");
}
-
}
public void test02()
@@ -61,7 +60,268 @@
// Success
}
}
+
+ public void test03()
+ {
+ EmailValidator emailValidator = new EmailValidator();
+ try
+ {
+ emailValidator.validate(null, null, "@blah");
+ fail("@blah should not be valid");
+ }
+ catch(ValidatorException e)
+ {
+ // Success
+ }
+ }
+
+ public void test04()
+ {
+ EmailValidator emailValidator = new EmailValidator();
+ try
+ {
+ emailValidator.validate(null, null, "(a)blah.com");
+ fail("(a)blah.com should not be valid");
+ }
+ catch(ValidatorException e)
+ {
+ // Success
+ }
+ }
+
+ public void test05()
+ {
+ EmailValidator emailValidator = new EmailValidator();
+ try
+ {
+ emailValidator.validate(null, null, "user.name(a)email.info");
+ }
+ catch(ValidatorException e)
+ {
+ fail("user.name(a)email.info should be valid");
+ }
+ }
+
+ public void test06()
+ {
+ EmailValidator emailValidator = new EmailValidator();
+ try
+ {
+ emailValidator.validate(null, null, "user_name(a)email.org");
+ }
+ catch(ValidatorException e)
+ {
+ fail("user_name(a)email.org should be valid");
+ }
+ }
+
+ public void test07()
+ {
+ EmailValidator emailValidator = new EmailValidator();
+ try
+ {
+ emailValidator.validate(null, null, "e*mail(a)email.com");
+ fail("e*mail(a)email.com should not be valid");
+ }
+ catch(ValidatorException e)
+ {
+ // Success
+ }
+ }
+ public void test08()
+ {
+ EmailValidator emailValidator = new EmailValidator();
+ try
+ {
+ emailValidator.validate(null, null, "*(a)blah.com");
+ fail("*@blah should not be valid");
+ }
+ catch(ValidatorException e)
+ {
+ // Success
+ }
+ }
+
+ public void test09()
+ {
+ EmailValidator emailValidator = new EmailValidator();
+ try
+ {
+ emailValidator.validate(null, null, "user@.com");
+ fail("user@.com should not be valid");
+ }
+ catch(ValidatorException e)
+ {
+ // Success
+ }
+ }
+ public void test10()
+ {
+ EmailValidator emailValidator = new EmailValidator();
+ try
+ {
+ emailValidator.validate(null, null, "user(a)a\\.com");
+ fail("user(a)a\\.com should not be valid");
+ }
+ catch(ValidatorException e)
+ {
+ // Success
+ }
+ }
+
+ public void test11()
+ {
+ EmailValidator emailValidator = new EmailValidator();
+ try
+ {
+ emailValidator.validate(null, null, "user@abc-com");
+ fail("user@abc-com should not be valid");
+ }
+ catch(ValidatorException e)
+ {
+ // Success
+ }
+ }
+
+ public void test12()
+ {
+ EmailValidator emailValidator = new EmailValidator();
+ try
+ {
+ emailValidator.validate(null, null, "us/er(a)a.com");
+ fail("us/er(a)a.com should not be valid");
+ }
+ catch(ValidatorException e)
+ {
+ // Success
+ }
+ }
+
+ public void test13()
+ {
+ EmailValidator emailValidator = new EmailValidator();
+ try
+ {
+ emailValidator.validate(null, null, "user@ab)com");
+ fail("user@ab)com should not be valid");
+ }
+ catch(ValidatorException e)
+ {
+ // Success
+ }
+ }
+
+ public void test14()
+ {
+ EmailValidator emailValidator = new EmailValidator();
+ try
+ {
+ emailValidator.validate(null, null, "user@ab/com");
+ fail("user@ab/com should not be valid");
+ }
+ catch(ValidatorException e)
+ {
+ // Success
+ }
+ }
+
+ public void test15()
+ {
+ EmailValidator emailValidator = new EmailValidator();
+ try
+ {
+ emailValidator.validate(null, null, "user@abc_com");
+ fail("user@abc_com should not be valid");
+ }
+ catch(ValidatorException e)
+ {
+ // Success
+ }
+ }
+
+ public void test16()
+ {
+ EmailValidator emailValidator = new EmailValidator();
+ try
+ {
+ emailValidator.validate(null, null, "user@a*com");
+ fail("user@a*com should not be valid");
+ }
+ catch(ValidatorException e)
+ {
+ // Success
+ }
+ }
+
+ public void test17()
+ {
+ EmailValidator emailValidator = new EmailValidator();
+ try
+ {
+ emailValidator.validate(null, null, "user(a)w-h.com");
+ }
+ catch(ValidatorException e)
+ {
+ fail("user(a)w-h.com should be valid");
+ }
+ }
+
+ public void test18()
+ {
+ EmailValidator emailValidator = new EmailValidator();
+ try
+ {
+ emailValidator.validate(null, null, "user@abc..com");
+ fail("user@abc..com should not be valid");
+ }
+ catch(ValidatorException e)
+ {
+
+ }
+ }
+
+ public void test19()
+ {
+ EmailValidator emailValidator = new EmailValidator();
+ try
+ {
+ emailValidator.validate(null, null, "user@.abc.com");
+ fail("user@.abc.com should be valid");
+ }
+ catch(ValidatorException e)
+ {
+ // Success
+ }
+ }
+
+ public void test20()
+ {
+ EmailValidator emailValidator = new EmailValidator();
+ try
+ {
+ emailValidator.validate(null, null, "(a)blah.com");
+ fail("(a)blah.com should not be valid");
+ }
+ catch(ValidatorException e)
+ {
+ // Success
+ }
+ }
+
+ public void test21()
+ {
+ EmailValidator emailValidator = new EmailValidator();
+ try
+ {
+ emailValidator.validate(null, null, "user(a)ab.museum");
+ }
+ catch(ValidatorException e)
+ {
+ fail("user(a)ab.museum should not be valid");
+ }
+ }
+
}
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/IdentityConstants.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/IdentityConstants.java 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/IdentityConstants.java 2007-08-17
18:22:12 UTC (rev 7984)
@@ -28,7 +28,22 @@
*/
public class IdentityConstants
{
+ public static final String HASH_SALT = "fuDrupRunEP2BRuspADr";
+
+ public static final String SUBSCRIPTIONMODE = "subscriptionMode";
public static final String SUBSCRIPTIONMODE_AUTOMATIC = "automatic";
public static final String SUBSCRIPTIONMODE_EMAILVERIFICATION =
"emailVerification";
+
+ public static final String VERIFICATION_ACTION = "validateEmail";
+ public static final String VERIFICATION_ACTION_REGISTER = "register";
+ public static final String VERIFICATION_ACTION_UPDATE_EMAIL = "update";
+ public static final String VERIFICATION_ACTION_DELETE_USER = "delete";
+
+ public static final String TEMPLATE_REGISTER_USER = "register";
+ public static final String TEMPLATE_CHANGE_EMAIL = "changeEmail";
+ public static final String TEMPLATE_LOST_PASSWORD = "lostPassword";
+
+ public static final String USER_PROFILE_GENERATED_HASH =
"org.jboss.portal.core.identity.validation_hash";
+ public static final String USER_PROFILE_NEW_EMAIL_ADDRESS =
"org.jboss.portal.core.identity.new_email";
}
Modified: trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/UIRole.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/UIRole.java 2007-08-17
15:41:47 UTC (rev 7983)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/UIRole.java 2007-08-17
18:22:12 UTC (rev 7984)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.identity.ui;
-import org.jboss.portal.identity.Role;
-
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
* @version $Revision$
@@ -36,7 +34,7 @@
/** . */
private String name;
-
+
/** . */
private String displayName;
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java 2007-08-17
18:22:12 UTC (rev 7984)
@@ -22,12 +22,8 @@
******************************************************************************/
package org.jboss.portal.core.identity.ui.actions;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.StringWriter;
-import java.net.URL;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@@ -36,21 +32,16 @@
import java.util.Map;
import javax.faces.application.FacesMessage;
+import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import org.jboss.logging.Logger;
-import org.jboss.portal.common.p3p.P3PConstants;
import org.jboss.portal.core.identity.ui.IdentityConstants;
import org.jboss.portal.core.identity.ui.IdentityUIUser;
import org.jboss.portal.core.identity.ui.common.IdentityUserBean;
-import org.jboss.portal.core.modules.MailModule;
-import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.core.identity.ui.common.SendMailBean;
import org.jboss.portal.identity.User;
-import freemarker.template.Configuration;
-import freemarker.template.Template;
-import freemarker.template.TemplateException;
-
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
* @version $Revision$
@@ -60,7 +51,7 @@
/** . */
private User user;
-
+
/** . */
private List roles = new ArrayList();
@@ -69,19 +60,16 @@
/** . */
private IdentityUserBean identityUserBean;
-
+
+ /** . */
+ private SendMailBean sendMailBean;
+
/** .*/
- private MailModule mailModule;
-
- /** .*/
private String subscriptionMode;
-
- /** . */
- private String emailDomain;
/** . */
private static final Logger log = Logger.getLogger(CreateUserAction.class);
-
+
public IdentityUIUser getUiUser()
{
return uiUser;
@@ -107,16 +95,6 @@
this.subscriptionMode = subscriptionMode;
}
- public String getEmailDomain()
- {
- return emailDomain;
- }
-
- public void setEmailDomain(String emailDomain)
- {
- this.emailDomain = emailDomain;
- }
-
public void setIdentityUserBean(IdentityUserBean identityUserBean)
{
this.identityUserBean = identityUserBean;
@@ -132,13 +110,14 @@
this.roles = roles;
}
- public MailModule getMailModule() {
- return mailModule;
+ public SendMailBean getSendMailBean()
+ {
+ return sendMailBean;
}
- public void setMailModule(MailModule mailModule)
+ public void setSendMailBean(SendMailBean sendMailBean)
{
- this.mailModule = mailModule;
+ this.sendMailBean = sendMailBean;
}
public String register()
@@ -149,107 +128,82 @@
try
{
- Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
Class registrationDateClass =
uiUser.getAttribute().getType("registrationdate");
// Create user && assign roles
- // user = identityUserBean.createUser(uiUser.getUsername(),
uiUser.getPassword(), this.roles);
-
+ user = identityUserBean.createUser(uiUser.getUsername(),
uiUser.getPassword(), this.roles);
+
//
- if ( registrationDateClass.equals(Date.class))
+ if (registrationDateClass.equals(Date.class))
{
uiUser.getAttribute().setValue("registrationdate", new Date());
}
- else if (registrationDateClass.equals(String.class) )
+ else if (registrationDateClass.equals(String.class))
{
- uiUser.getAttribute().setValue("registrationdate", (new
Date()).toString());
+ uiUser.getAttribute().setValue("registrationdate", (new
Date()).toString());
}
else
{
- log.warn(User.INFO_USER_REGISTRATION_DATE + " property is mapped in
not supported type: " + registrationDateClass.toString());
+ log.warn(User.INFO_USER_REGISTRATION_DATE + " property is mapped in
not supported type: "
+ + registrationDateClass.toString());
}
- if ( subscriptionMode != null &&
subscriptionMode.equals(IdentityConstants.SUBSCRIPTIONMODE_EMAILVERIFICATION))
+ if (subscriptionMode != null
+ &&
subscriptionMode.equals(IdentityConstants.SUBSCRIPTIONMODE_EMAILVERIFICATION))
{
+ Map mailMap = new HashMap();
+ String hash = identityUserBean.hashGen();
+
+ // Disable User
uiUser.getAttribute().setValue("enabled", Boolean.FALSE);
- String emailText = this.generateValidationEmail();
- String subject = "test"; // TODO
- String from = "no-reply(a)mucki.at"; // TODO
- log.debug(emailText);
-// mailModule.send(from, (String)
uiUser.getAttribute().getValue("email").getObject() , subject, emailText);
+
+ // TODO Store Hash
+ // identityUserBean.setPropertyHash(user, hash);
+
+ // TODO change IdentityCommandFactory
+ String link = "http://localhost:8080/portal/";
+ link += IdentityConstants.VERIFICATION_ACTION + "/";
+ link += IdentityConstants.VERIFICATION_ACTION_REGISTER + "/";
+ link += uiUser.getUsername() + "/";
+ link += hash + "/";
+ link += "default/default/wizardWindow_33";
+
+ mailMap.put("to", (String)
uiUser.getAttribute().getValue("email").getObject());
+ mailMap.put("username", uiUser.getUsername());
+ mailMap.put("password", uiUser.getPassword());
+ mailMap.put("activationLink", link);
+
+ // Sending verification mail
+ this.sendMailBean.sendMail("register", mailMap);
+
}
else
{
uiUser.getAttribute().setValue("enabled", Boolean.TRUE);
}
-
+
// Adding dynamically set properties
- //identityUserBean.updateProfile(user,
uiUser.getAttribute().getProfileAttributes());
-
+ identityUserBean.updateProfile(user,
uiUser.getAttribute().getProfileAttributes());
+
}
catch (Exception e)
{
e.printStackTrace();
FacesContext.getCurrentInstance().addMessage(null, new
FacesMessage("Could not register user."));
}
-
}
else
{
FacesContext.getCurrentInstance().addMessage(null, new
FacesMessage("Missing required values."));
}
-
+
+ // Clean up
+
this.user = null;
- this.uiUser = null;
-
+ this.uiUser = new IdentityUIUser();
+
return "success";
}
- private String generateValidationEmail()
- {
- Map modelRoot = new HashMap();
- modelRoot.put("emailDomain", this.emailDomain);
- modelRoot.put("id", "userID"); // TODO
- modelRoot.put("username", uiUser.getUsername());
- modelRoot.put("password", uiUser.getPassword());
- modelRoot.put("activationLink", "link"); // TODO
-
- ClassLoader tcl = Thread.currentThread().getContextClassLoader();
- String message = null;
- try
- {
-
- Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
- URL config = tcl.getResource("templates/register/emailTemplate_" +
locale.getLanguage() + "_" + locale.getCountry()+ ".tpl");
- if (config == null)
- {
- config = tcl.getResource("templates/register/emailTemplate_" +
locale.getLanguage() + ".tpl");
- }
- if (config == null)
- {
- config = tcl.getResource("templates/register/emailTemplate.tpl");
- }
- if (config == null)
- {
- throw new FileNotFoundException("Cannot load a suitable
emailTemplate.tpl in templates/user");
- }
- InputStream in = config.openStream();
- Template tpl = new Template("emailTemplate", new
InputStreamReader(in), new Configuration());
- StringWriter out = new StringWriter();
- tpl.process(modelRoot, out);
- out.close();
- message = out.toString();
- }
- catch (IOException e1)
- {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- catch (TemplateException e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return message;
- }
+
}
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java 2007-08-17
18:22:12 UTC (rev 7984)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.core.identity.ui.actions;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
import java.util.HashMap;
import java.util.Map;
@@ -30,8 +32,11 @@
import javax.faces.context.FacesContext;
import org.jboss.logging.Logger;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.core.identity.ui.IdentityConstants;
import org.jboss.portal.core.identity.ui.IdentityUIUser;
import org.jboss.portal.core.identity.ui.common.IdentityUserBean;
+import org.jboss.portal.core.identity.ui.common.SendMailBean;
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.User;
@@ -55,6 +60,9 @@
/** . */
private IdentityUserBean identityUserBean;
+
+ /** . */
+ private SendMailBean sendMailBean;
private static final Logger log = Logger.getLogger(EditProfileAction.class);
@@ -120,6 +128,16 @@
this.email = email;
}
+ public SendMailBean getSendMailBean()
+ {
+ return sendMailBean;
+ }
+
+ public void setSendMailBean(SendMailBean sendMailBean)
+ {
+ this.sendMailBean = sendMailBean;
+ }
+
public String editProfile()
{
FacesContext ctx = FacesContext.getCurrentInstance();
@@ -157,12 +175,13 @@
public String changePassword()
{
-
if (this.password != null)
{
try
{
+ // Update password
this.identityUserBean.updatePassword(this.currentUser, this.password);
+
}
catch (Exception e)
{
@@ -175,14 +194,45 @@
public String changeEmail()
{
+ String subscriptionMode =
FacesContext.getCurrentInstance().getExternalContext().getInitParameter(
+ IdentityConstants.SUBSCRIPTIONMODE);
+
if (this.email != null)
{
try
{
- HashMap profileMap = new HashMap();
User user = this.identityUserBean.findUserByUserName(this.currentUser);
- profileMap.put("email", email);
- this.identityUserBean.updateProfile(user, profileMap);
+ if (subscriptionMode != null
+ &&
subscriptionMode.equals(IdentityConstants.SUBSCRIPTIONMODE_EMAILVERIFICATION))
+ {
+ Map mailMap = new HashMap();
+ String hash = identityUserBean.hashGen();
+ this.identityUserBean.setPropertyHash(user, hash);
+ this.identityUserBean.setPropertyNewEmail(user, email);
+
+ // Generate URL
+ String link = "http://localhost:8080/portal/";
+ link += IdentityConstants.VERIFICATION_ACTION + "/";
+ link += IdentityConstants.VERIFICATION_ACTION_UPDATE_EMAIL+
"/";
+ link += uiUser.getUsername() + "/";
+ link += hash + "/";
+ link += "default/default/wizardWindow_33";
+
+ // TODO - get right Values
+ mailMap.put("subject", "Confirm Email Change");
+ mailMap.put("to", email); //(String)
uiUser.getAttribute().getValue("email").getObject());
+ mailMap.put("from", "emuckenh(a)redhat.com");
+ mailMap.put("emailDomain", "JBoss.org");
+ mailMap.put("activationLink", link);
+
+ this.sendMailBean.sendMail("changeEmail", mailMap);
+ }
+ else
+ {
+ HashMap profileMap = new HashMap();
+ profileMap.put("email", email);
+ this.identityUserBean.updateProfile(user, profileMap);
+ }
}
catch (Exception e)
{
@@ -192,4 +242,5 @@
}
return "start";
}
+
}
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/LostPasswordAction.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/LostPasswordAction.java 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/LostPasswordAction.java 2007-08-17
18:22:12 UTC (rev 7984)
@@ -22,6 +22,11 @@
******************************************************************************/
package org.jboss.portal.core.identity.ui.actions;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.naming.InitialContext;
@@ -29,8 +34,10 @@
import org.hibernate.Session;
import org.hibernate.SessionFactory;
+import org.jboss.logging.Logger;
+import org.jboss.portal.core.identity.ui.IdentityUIUser;
import org.jboss.portal.core.identity.ui.common.IdentityUserBean;
-import org.jboss.portal.core.modules.MailModule;
+import org.jboss.portal.core.identity.ui.common.SendMailBean;
import org.jboss.portal.identity.NoSuchUserException;
import org.jboss.portal.identity.User;
@@ -40,81 +47,169 @@
*/
public class LostPasswordAction
{
+ /** . */
private String username;
+
+ /** . */
private String email;
-
+
+ /** . */
+ private String passwordCharacters;
+
+ /** . */
private IdentityUserBean identityUserBean;
+
+ /** . */
+ private SendMailBean sendMailBean;
+
+ /** . */
private Session session;
-
- public LostPasswordAction()
+
+ /** . */
+ private static final Logger log = Logger.getLogger(LostPasswordAction.class);
+
+ /**
+ public LostPasswordAction()
{
- try
- {
- SessionFactory sessionFactory = (SessionFactory)new
InitialContext().lookup("java:/portal/IdentitySessionFactory");
+ SessionFactory sessionFactory = (SessionFactory) new InitialContext()
+ .lookup("java:/portal/IdentitySessionFactory");
session = sessionFactory.getCurrentSession();
- }
- catch (NamingException e)
- {
- // FIXME
- e.printStackTrace();
- }
- }
-
+ } */
+
public String getUsername()
{
return username;
}
+
public void setUsername(String username)
{
this.username = username;
}
+
public String getEmail()
{
return email;
}
+
public void setEmail(String email)
{
this.email = email;
}
-
- public String doomed()
+
+ public IdentityUserBean getIdentityUserBean()
{
-
- if ( username != null && email == null)
+ return identityUserBean;
+ }
+
+ public void setIdentityUserBean(IdentityUserBean identityUserBean)
+ {
+ this.identityUserBean = identityUserBean;
+ }
+
+ public SendMailBean getSendMailBean()
+ {
+ return sendMailBean;
+ }
+
+ public void setSendMailBean(SendMailBean sendMailBean)
+ {
+ this.sendMailBean = sendMailBean;
+ }
+
+ public String getPasswordCharacters()
+ {
+ return passwordCharacters;
+ }
+
+ public void setPasswordCharacters(String passwordCharacters)
+ {
+ this.passwordCharacters = passwordCharacters;
+ }
+
+ public String doomed()
+ {
+ User user = null;
+
+ if (username != null && !username.equals(""))
{
try
{
- User user = identityUserBean.findUserByUserName(username);
- // Send email with new credentials
+ user = identityUserBean.findUserByUserName(username);
}
catch (NoSuchUserException e)
{
- FacesContext.getCurrentInstance().addMessage("username", new
FacesMessage("no account with this username found."));
+ FacesContext.getCurrentInstance()
+ .addMessage(null, new FacesMessage("no account with this username
found."));
+ return "lostPassword";
}
catch (Exception e)
{
e.printStackTrace();
- FacesContext.getCurrentInstance().addMessage("username", new
FacesMessage("Error"));
+ FacesContext.getCurrentInstance().addMessage(null, new
FacesMessage("Failed to reset password."));
+ return "status";
}
- } else if ( username== null && email != null )
+ }
+ /**
+ * TODO else if - get user by email address
+ */
+ else
{
- // Search properties
- // Then send email with new credentials
-
- } else {
return "lostPassword";
}
- return "lostPassword";
+
+ if (user != null)
+ {
+ Map mailMap = new HashMap();
+
+ String newPassword = this.genPassword(8);
+
+ IdentityUIUser uiUser = new IdentityUIUser(user.getUserName());
+
+ // TODO - get right Values
+ mailMap.put("to", (String)
uiUser.getAttribute().getValue("email").getObject());
+ mailMap.put("username", user.getUserName());
+ mailMap.put("password", newPassword);
+
+ try
+ {
+ // TODO enable update Password
+ // identityUserBean.updatePassword(user.getUserName(), newPassword);
+ sendMailBean.sendMail("lostPassword", mailMap);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ FacesContext.getCurrentInstance().addMessage(null, new
FacesMessage("Failed to reset password."));
+ return "status";
+ }
+ }
+ FacesContext.getCurrentInstance().addMessage(null,
+ new FacesMessage("Email with new credentials successfully
sent."));
+ return "status";
}
-
- private String generatePassword()
+
+ private String genPassword(int length)
{
- return "rand0mPa55w0rd";
+ StringBuffer buffer = new StringBuffer();
+ try
+ {
+ char[] characterMap = passwordCharacters.toCharArray();
+ SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
+
+ for (int i = 0; i <= length; i++)
+ {
+ byte[] bytes = new byte[512];
+ secureRandom.nextBytes(bytes);
+ double number = secureRandom.nextDouble();
+ int b = ((int) (number * characterMap.length));
+ buffer.append(characterMap[b]);
+ }
+ }
+ catch (NoSuchAlgorithmException e)
+ {
+ log.error("No Such Algorithm exists " + e);
+ }
+
+ return buffer.toString();
}
-
- private boolean sendEmail() {
- return false;
- }
-
}
-
Deleted:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/ValidateEmailServlet.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/ValidateEmailServlet.java 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/ValidateEmailServlet.java 2007-08-17
18:22:12 UTC (rev 7984)
@@ -1,96 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.identity.ui.actions;
-
-import java.io.IOException;
-
-import javax.naming.InitialContext;
-import javax.servlet.ServletException;
-import javax.servlet.UnavailableException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.identity.NoSuchUserException;
-import org.jboss.portal.identity.User;
-import org.jboss.portal.identity.UserModule;
-import org.jboss.portal.identity.UserProfileModule;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
- * @version $Revision$
- */
-public class ValidateEmailServlet extends HttpServlet
-{
- private UserModule userModule;
- private UserProfileModule userProfileModule;
-
- public void init() throws ServletException
- {
- try
- {
- super.init();
- InitialContext context = new InitialContext();
- userModule = (UserModule) context.lookup("java:portal/UserModule");
- userProfileModule = (UserProfileModule)
context.lookup("java:portal/UserProfileModule");
- }
- catch (Exception e)
- {
- throw new UnavailableException(e.toString());
- }
- }
-
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException
- {
- this.doPost(request, response);
- }
-
- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException
- {
- String userId = request.getParameter("uId");
- String hash = request.getParameter("hash");
-
- try
- {
- User user = userModule.findUserById(userId);
- String email = (String) userProfileModule.getProperty(user,
User.INFO_USER_EMAIL_REAL);
- }
- catch (IllegalArgumentException e)
- {
- // FIXME
- e.printStackTrace();
- }
- catch (NoSuchUserException e)
- {
- // FIXME
- e.printStackTrace();
- }
- catch (IdentityException e)
- {
- // FIXME
- e.printStackTrace();
- }
- }
-}
-
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java 2007-08-17
18:22:12 UTC (rev 7984)
@@ -23,9 +23,11 @@
package org.jboss.portal.core.identity.ui.admin;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.faces.application.FacesMessage;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.model.DataModel;
@@ -51,16 +53,16 @@
/** . */
private ListDataModel userList;
-
+
/** . */
private int page = 1;
-
+
/** . */
private int limit = 10;
-
+
/** . */
private int userCount;
-
+
/** . */
private List roles = new ArrayList();
@@ -165,7 +167,7 @@
{
try
{
- int offset = page > 0 ? ((page - 1) * limit) : 0;
+ int offset = page > 0 ? ((page - 1) * limit) : 0;
this.userList = new
ListDataModel(identityUserBean.findUsersFilteredByUserName(searchString, offset, limit));
}
catch (IllegalArgumentException e)
@@ -187,6 +189,46 @@
return "userAdmin";
}
+ public String enableUser()
+ {
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ ExternalContext ectx = ctx.getExternalContext();
+ Map params = ectx.getRequestParameterMap();
+ String action = (String) params.get("enableAction");
+ this.currentUser = (String) params.get("currentUser");
+
+ // TODO - do something better than .equals("admin")
+ if (this.currentUser != null && action != null && !
this.currentUser.equals("admin"))
+ {
+ HashMap profileMap = new HashMap();
+ User user;
+
+ try
+ {
+ user = identityUserBean.findUserByUserName(this.currentUser);
+
+ if (action.equals("enable"))
+ {
+ profileMap.put("enabled", Boolean.TRUE);
+ }
+ else if (action.equals("disable"))
+ {
+ profileMap.put("enabled", Boolean.FALSE);
+ }
+ // Enabling user
+ identityUserBean.updateProfile(user, profileMap);
+ }
+ catch (Exception e)
+ {
+ log.error("unable to get user: " + this.currentUser, e);
+ return "userAdmin";
+ }
+ // Updating search
+ return this.searchUsers();
+ }
+ return "userAdmin";
+ }
+
public String deleteUser()
{
FacesContext ctx = FacesContext.getCurrentInstance();
@@ -210,7 +252,7 @@
}
catch (Exception e)
{
- e.printStackTrace();
+ log.error("unable delete user.", e);
}
return "userAdmin";
}
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityUserBean.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityUserBean.java 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityUserBean.java 2007-08-17
18:22:12 UTC (rev 7984)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.core.identity.ui.common;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -30,6 +32,8 @@
import java.util.Set;
import org.jboss.logging.Logger;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.core.identity.ui.IdentityConstants;
import org.jboss.portal.core.identity.ui.IdentityUIUser;
import org.jboss.portal.core.identity.ui.UIAttribute;
import org.jboss.portal.core.identity.ui.UIRole;
@@ -180,4 +184,43 @@
UIAttribute uiAttribute = (UIAttribute)
this.metaDataService.getValue(propertyName).getObject();
return this.userProfileModule.getProperty(user, uiAttribute.getIdentifier());
}
+
+
+ // Used to save the hash into the properties of the user
+ public void setPropertyHash(User user, String hash) throws IllegalArgumentException,
IdentityException
+ {
+ this.userProfileModule.setProperty(user,
IdentityConstants.USER_PROFILE_GENERATED_HASH, hash);
+ }
+
+ // Stores the new email address until it is validated
+ public void setPropertyNewEmail(User user, String email) throws
IllegalArgumentException, IdentityException
+ {
+ this.userProfileModule.setProperty(user,
IdentityConstants.USER_PROFILE_NEW_EMAIL_ADDRESS, email);
+ }
+
+ // generating a random hash
+ public String hashGen() {
+ try {
+ SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
+
+ byte[] bytes = new byte[512];
+ secureRandom.nextBytes(bytes);
+
+ double rand = secureRandom.nextDouble();
+ long time = System.currentTimeMillis();
+ String salt = IdentityConstants.HASH_SALT;
+
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(rand);
+ buffer.append(salt);
+ buffer.append(time);
+
+
+ return Tools.md5AsHexString(buffer.toString());
+ } catch (NoSuchAlgorithmException e)
+ {
+ log.error("No Such Algorithm exists " + e);
+ }
+ return null;
+ }
}
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/MetaDataServiceBean.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/MetaDataServiceBean.java 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/MetaDataServiceBean.java 2007-08-17
18:22:12 UTC (rev 7984)
@@ -26,6 +26,7 @@
import java.util.Set;
import org.jboss.portal.common.p3p.P3PConstants;
+import org.jboss.portal.core.identity.ui.IdentityConstants;
import org.jboss.portal.core.identity.ui.UIAttribute;
import org.jboss.portal.faces.el.PropertyValue;
import org.jboss.portal.faces.el.dynamic.DynamicBean;
@@ -35,16 +36,22 @@
* @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
* @version $Revision$
*/
-public class MetaDataServiceBean implements DynamicBean
+public class MetaDataServiceBean implements DynamicBean
{
+ /** . */
HashMap map = new HashMap();
-
- public MetaDataServiceBean() {
+
+ public MetaDataServiceBean()
+ {
UIAttribute uiEmail = new
UIAttribute(P3PConstants.INFO_USER_BUSINESS_INFO_ONLINE_EMAIL, "email");
uiEmail.setValidator("EmailValidator");
uiEmail.setRequired(true);
+ // Required
+ UIAttribute uiHash = new UIAttribute(IdentityConstants.USER_PROFILE_GENERATED_HASH,
"org_jboss_identity_hash");
+ UIAttribute uiNewEmail = new
UIAttribute(IdentityConstants.USER_PROFILE_NEW_EMAIL_ADDRESS,
"org_jboss_identity_new_email");
+
UIAttribute uiGivenName = new UIAttribute(P3PConstants.INFO_USER_NAME_GIVEN,
"givenname");
UIAttribute uiFamilyName = new UIAttribute(P3PConstants.INFO_USER_NAME_FAMILY,
"familyname");
UIAttribute uiSkype = new UIAttribute(User.INFO_USER_IM_SKYPE, "skype");
@@ -55,20 +62,23 @@
UIAttribute uiInterests = new UIAttribute(User.INFO_USER_INTERESTS,
"interests");
UIAttribute uiLocale = new UIAttribute(User.INFO_USER_LOCALE, "locale");
UIAttribute uiIcq = new UIAttribute(User.INFO_USER_IM_ICQ, "icq");
- UIAttribute uiAim = new UIAttribute(User.INFO_USER_IM_AIM, "aim" );
- UIAttribute uiMsmn = new UIAttribute(User.INFO_USER_IM_MSNM, "msnm" );
- UIAttribute uiYim = new UIAttribute(User.INFO_USER_IM_YIM, "yim" );
+ UIAttribute uiAim = new UIAttribute(User.INFO_USER_IM_AIM, "aim");
+ UIAttribute uiMsmn = new UIAttribute(User.INFO_USER_IM_MSNM, "msnm");
+ UIAttribute uiYim = new UIAttribute(User.INFO_USER_IM_YIM, "yim");
UIAttribute uiXmmp = new UIAttribute(User.INFO_USER_IM_XMMP, "xmmp");
- UIAttribute uiHomepage = new UIAttribute(User.INFO_USER_HOMEPAGE,
"homepage" );
- UIAttribute uiTimeZone = new UIAttribute(User.INFO_USER_TIME_ZONE_OFFSET,
"timezone" );
- UIAttribute uiTheme = new UIAttribute(User.INFO_USER_THEME, "theme" );
- UIAttribute uiSecurityQuestion = new UIAttribute(User.INFO_USER_SECURITY_QUESTION,
"securityquestion" );
- UIAttribute uiSecurityAnswer = new UIAttribute(User.INFO_USER_SECURITY_ANSWER,
"securityanswer" );
- UIAttribute uiLastLogin = new UIAttribute(User.INFO_USER_LAST_LOGIN_DATE,
"lastlogin" );
- UIAttribute uiRegistrationDate = new UIAttribute(User.INFO_USER_REGISTRATION_DATE,
"registrationdate" );
- UIAttribute uiEnabled = new UIAttribute(User.INFO_USER_ENABLED, "enabled"
);
+ UIAttribute uiHomepage = new UIAttribute(User.INFO_USER_HOMEPAGE,
"homepage");
+ UIAttribute uiTimeZone = new UIAttribute(User.INFO_USER_TIME_ZONE_OFFSET,
"timezone");
+ UIAttribute uiTheme = new UIAttribute(User.INFO_USER_THEME, "theme");
+ UIAttribute uiSecurityQuestion = new UIAttribute(User.INFO_USER_SECURITY_QUESTION,
"securityquestion");
+ UIAttribute uiSecurityAnswer = new UIAttribute(User.INFO_USER_SECURITY_ANSWER,
"securityanswer");
+ UIAttribute uiLastLogin = new UIAttribute(User.INFO_USER_LAST_LOGIN_DATE,
"lastlogin");
+ UIAttribute uiRegistrationDate = new UIAttribute(User.INFO_USER_REGISTRATION_DATE,
"registrationdate");
+ UIAttribute uiEnabled = new UIAttribute(User.INFO_USER_ENABLED,
"enabled");
+
+ this.addToMap(uiEmail);
+ this.addToMap(uiHash);
+ this.addToMap(uiNewEmail);
- this.addToMap(uiEmail);
this.addToMap(uiGivenName);
this.addToMap(uiFamilyName);
this.addToMap(uiSkype);
@@ -91,7 +101,6 @@
this.addToMap(uiLastLogin);
this.addToMap(uiRegistrationDate);
this.addToMap(uiEnabled);
-
}
public Class getType(Object propertyName) throws IllegalArgumentException
@@ -101,7 +110,7 @@
public PropertyValue getValue(Object propertyName) throws IllegalArgumentException
{
- UIAttribute uiAttribute = (UIAttribute) map.get((String) propertyName);
+ UIAttribute uiAttribute = (UIAttribute) map.get((String) propertyName);
return uiAttribute != null ? new PropertyValue(uiAttribute) : null;
}
@@ -109,11 +118,10 @@
{
return false;
}
-
+
private void addToMap(UIAttribute uiAttribute)
{
this.map.put(uiAttribute.getName(), uiAttribute);
}
}
-
Added:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/SendMailBean.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/SendMailBean.java
(rev 0)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/SendMailBean.java 2007-08-17
18:22:12 UTC (rev 7984)
@@ -0,0 +1,166 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.identity.ui.common;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import javax.faces.context.FacesContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.core.identity.ui.IdentityConstants;
+import org.jboss.portal.core.modules.MailModule;
+
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class SendMailBean
+{
+
+ /** . */
+ private Map mailData = new HashMap();
+
+ /** . */
+ private Locale locale;
+
+ /** . */
+ private String emailText = null;
+
+ /** . */
+ private String emailDomain;
+
+ /** . */
+ private String emailFrom;
+
+ /** . */
+ private String templateLocation;
+
+ /** . */
+ private MailModule mailModule;
+
+ /** . */
+ private static final Logger log = Logger.getLogger(SendMailBean.class);
+
+ public String getEmailDomain()
+ {
+ return emailDomain;
+ }
+
+ public void setEmailDomain(String emailDomain)
+ {
+ this.emailDomain = emailDomain;
+ }
+
+ public String getEmailFrom()
+ {
+ return emailFrom;
+ }
+
+ public void setEmailFrom(String emailFrom)
+ {
+ this.emailFrom = emailFrom;
+ }
+
+ public MailModule getMailModule()
+ {
+ return mailModule;
+ }
+
+ public void setMailModule(MailModule mailModule)
+ {
+ this.mailModule = mailModule;
+ }
+
+ public void sendMail(String templateLocation, Map mailData) throws IOException,
TemplateException
+ {
+ this.templateLocation = templateLocation;
+ this.mailData = mailData;
+ this.locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
+ this.mailData.put("emailDomain", emailDomain);
+
+ ResourceBundle bundle = ResourceBundle.getBundle("Identity", locale);
+
+ String subject = null;
+ String to = (String) mailData.get("to");
+
+ if (IdentityConstants.TEMPLATE_REGISTER_USER.equals(templateLocation))
+ {
+ subject = bundle.getString("IDENTITY_MAIL_SUBJECT_REGISTER");
+ } else if (IdentityConstants.TEMPLATE_CHANGE_EMAIL.equals(templateLocation))
+ {
+ subject = bundle.getString("IDENTITY_MAIL_SUBJECT_CHANGE_EMAIL");
+ } else if (IdentityConstants.TEMPLATE_LOST_PASSWORD.equals(templateLocation))
+ {
+ subject = bundle.getString("IDENTITY_MAIL_SUBJECT_LOST_PASSWORD");
+ } else
+ {
+ throw new IllegalArgumentException("unknown template.");
+ }
+
+ // Generating message
+ this.generateEmailText();
+
+ // Sending mail
+ // mailModule.send(emailFrom, to , subject, emailText);
+ log.debug(this.emailText);
+ }
+
+ private void generateEmailText() throws IOException, TemplateException
+ {
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ URL config = tcl.getResource("templates/" + this.templateLocation +
"/emailTemplate_" + locale.getLanguage() + "_" + locale.getCountry() +
".tpl");
+ if (config == null)
+ {
+ config = tcl.getResource("templates/" + this.templateLocation +
"/emailTemplate_" + locale.getLanguage() + ".tpl");
+ }
+ if (config == null)
+ {
+ config = tcl.getResource("templates/" + this.templateLocation +
"/emailTemplate.tpl");
+ }
+ if (config == null)
+ {
+ throw new FileNotFoundException("Cannot load a suitable emailTemplate.tpl
in templates/"
+ + this.templateLocation);
+ }
+ InputStream in = config.openStream();
+ Template tpl = new Template("emailTemplate", new InputStreamReader(in),
new Configuration());
+ StringWriter out = new StringWriter();
+ tpl.process(this.mailData, out);
+ out.close();
+
+ this.emailText = out.toString();
+ }
+}
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/CurrentPasswordValidator.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/CurrentPasswordValidator.java 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/CurrentPasswordValidator.java 2007-08-17
18:22:12 UTC (rev 7984)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.identity.ui.validators;
-import java.util.regex.Pattern;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -41,10 +40,16 @@
public class CurrentPasswordValidator implements Validator
{
+ /** . */
private UserModule userModule;
+
+ /** . */
private String currentUser;
+
+ /** . */
private User user;
-
+
+ /** . */
private static final Logger log = Logger.getLogger(CurrentPasswordValidator.class);
public void validate(FacesContext context, UIComponent component, Object value) throws
ValidatorException
@@ -56,13 +61,15 @@
{
user = userModule.findUserByUserName(this.currentUser);
- } catch (Exception e) {
- throw new ValidatorException( new FacesMessage("Password cannot be
validated."));
}
-
+ catch (Exception e)
+ {
+ throw new ValidatorException(new FacesMessage("Password cannot be
validated."));
+ }
+
if (user == null || (!user.validatePassword((String) value)))
{
- throw new ValidatorException( new FacesMessage("Password is not
valid."));
+ throw new ValidatorException(new FacesMessage("Password is not
valid."));
}
}
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/EmailValidator.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/EmailValidator.java 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/EmailValidator.java 2007-08-17
18:22:12 UTC (rev 7984)
@@ -35,25 +35,28 @@
*/
public class EmailValidator implements Validator
{
- private static final String EMAIL_VALIDATION =
"^([a-zA-Z0-9]+(([\\.\\-\\_]?[a-zA-Z0-9]+)+)?)\\(a)(([a-zA-Z0-9]+[\\.\\-\\_])+[a-zA-Z]{2,4})$";
-
- public void validate(FacesContext context, UIComponent component, Object value)
throws ValidatorException
+ /** . */
+ private static final String EMAIL_VALIDATION =
"^[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*\\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$";
+
+ public void validate(FacesContext context, UIComponent component, Object value) throws
ValidatorException
+ {
+ if (value != null)
{
- if(value != null)
+ if (!(value instanceof String))
{
- if (!(value instanceof String)) {
- throw new IllegalArgumentException("The value must be a
String");
- }
-
- if (! Pattern.matches(this.EMAIL_VALIDATION, (String) value))
- {
- throw new ValidatorException( new FacesMessage("Invalid EMail
Address"));
- }
-
- } else {
- throw new ValidatorException( new FacesMessage("Required"));
+ throw new IllegalArgumentException("The value must be a String");
}
-
+
+ if (!Pattern.matches(this.EMAIL_VALIDATION, (String) value))
+ {
+ throw new ValidatorException(new FacesMessage("Invalid EMail
Address"));
+ }
+
}
+ else
+ {
+ throw new ValidatorException(new FacesMessage("Required"));
+ }
+
+ }
}
-
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/PasswordValidator.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/PasswordValidator.java 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/PasswordValidator.java 2007-08-17
18:22:12 UTC (rev 7984)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.identity.ui.validators;
-import java.util.regex.Pattern;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.component.html.HtmlInputSecret;
@@ -37,19 +36,21 @@
public class PasswordValidator implements Validator
{
public void validate(FacesContext context, UIComponent component, Object value) throws
ValidatorException
+ {
+ UIComponent passwordComponent = component.findComponent("password");
+ if (passwordComponent != null && passwordComponent instanceof
HtmlInputSecret)
{
- UIComponent passwordComponent = component.findComponent("password");
- if (passwordComponent != null && passwordComponent instanceof
HtmlInputSecret)
+ String password = (String) ((HtmlInputSecret) passwordComponent).getValue();
+
+ if (!password.equals((String) value))
{
- String password = (String) ((HtmlInputSecret) passwordComponent).getValue();
-
- if (! password.equals((String) value))
- {
- throw new ValidatorException( new FacesMessage("The passwords
don't match."));
- }
-
- } else {
- throw new ValidatorException( new FacesMessage("Passwords cannot be
checked."));
+ throw new ValidatorException(new FacesMessage("The passwords don't
match."));
}
+
}
+ else
+ {
+ throw new ValidatorException(new FacesMessage("Passwords cannot be
checked."));
+ }
+ }
}
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java 2007-08-17
18:22:12 UTC (rev 7984)
@@ -43,9 +43,13 @@
public class UsernameValidator implements Validator
{
+ /** . */
private static final String NICKNAME_VALIDATION =
"^[a-zA-Z]([a-zA-Z0-9]+(([\\.\\-\\_]?[a-zA-Z0-9]+)+)?)";
+
+ /** . */
private UserModule userModule;
-
+
+ /** . */
private static final Logger log = Logger.getLogger(UsernameValidator.class);
public void validate(FacesContext context, UIComponent component, Object value) throws
ValidatorException
@@ -64,7 +68,7 @@
}
catch (NoSuchUserException e)
{
- // No user found - proceed
+ // No user found - proceed
}
catch (IllegalArgumentException e)
{
@@ -74,8 +78,9 @@
{
throw new ValidatorException(new FacesMessage("Error while checking
username (IdentityException)."));
}
-
- } else {
+ }
+ else
+ {
throw new ValidatorException(new FacesMessage("Invalid Username."));
}
}
Modified:
trunk/core-identity/src/resources/portal-identity-sar/META-INF/jboss-service.xml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-sar/META-INF/jboss-service.xml 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/resources/portal-identity-sar/META-INF/jboss-service.xml 2007-08-17
18:22:12 UTC (rev 7984)
@@ -22,5 +22,42 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<server>
-
-</server>
+ <mbean
+
code="org.jboss.portal.core.identity.services.IdentityCommandFactoryService"
+ name="portal:commandFactory=IdentityUI"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends
+ optional-attribute-name="ServerConfig"
+ proxy-type="attribute">portal:service=ServerConfig</depends>
+ </mbean>
+
+ <mbean
+
code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
+ name="portal:commandFactory=Delegate,path=validateEmail"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="Path">/validateEmail</attribute>
+ <depends
+ optional-attribute-name="DelegatingFactory"
+
proxy-type="attribute">portal:commandFactory=Delegating</depends>
+ <depends
+ optional-attribute-name="DelegateFactory"
+
proxy-type="attribute">portal:commandFactory=IdentityUI</depends>
+ </mbean>
+<!--
+ <mbean
+ code="org.jboss.portal.core.identity.services.IdentityURLFactory"
+ name="portal:urlFactory=IdentityUI"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="Path">/validateEmail</attribute>
+ <depends
+ optional-attribute-name="Factory"
+
proxy-type="attribute">portal:urlFactory=Delegating</depends>
+ </mbean>
+ -->
+</server>
\ No newline at end of file
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/Identity.properties
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/Identity.properties 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/Identity.properties 2007-08-17
18:22:12 UTC (rev 7984)
@@ -36,7 +36,7 @@
IDENTITY_REGISTER_SUCCESS_TITLE=Your account has been sucessfully created.
IDENTITY_LOST_PASSWORD_TITLE=Forgot your login data?
-IDENTITY_LOST_PASSWORD_DESCRIPTION=Please enter your username or email address.
+IDENTITY_LOST_PASSWORD_DESCRIPTION=Please enter your username to reset your password
IDENTITY_EDIT_PASSWORD_TITLE=Change your password
IDENTITY_EDIT_PASSWORD_CURRENT=Current password
@@ -93,3 +93,8 @@
IDENTITY_REGISTER_TITLE_CONFIRM_DELETE=Confirmation: Delete Object
IDENTITY_REGISTER_CONFIRMATIONEMAIL=Confirm your subscription
+
+
+IDENTITY_MAIL_SUBJECT_LOST_PASSWORD=Reset your password
+IDENTITY_MAIL_SUBJECT_REGISTER=Confirm registration
+IDENTITY_MAIL_SUBJECT_CHANGE_EMAIL=Confirm email address
\ No newline at end of file
Added:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/templates/changeEmail/emailTemplate.tpl
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/templates/changeEmail/emailTemplate.tpl
(rev 0)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/templates/changeEmail/emailTemplate.tpl 2007-08-17
18:22:12 UTC (rev 7984)
@@ -0,0 +1,11 @@
+hello
+
+you tried to change your email address on ${emailDomain}
+
+
+Follow this link to verify your new address:
+${activationLink}
+
+
+Best regards,
+${emailDomain}
Added:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/templates/lostPassword/emailTemplate.tpl
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/templates/lostPassword/emailTemplate.tpl
(rev 0)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/templates/lostPassword/emailTemplate.tpl 2007-08-17
18:22:12 UTC (rev 7984)
@@ -0,0 +1,12 @@
+Hello,
+
+we have received your request to reset your password on ${emailDomain}.
+
+The user information are written here for your convenience:
+Username: ${username}
+Password: ${password}
+
+It is highly recommended that you change the generated password at your next login.
+
+Best regards,
+${emailDomain}
Modified: trunk/core-identity/src/resources/portal-identity-war/WEB-INF/faces-config.xml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/faces-config.xml 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/faces-config.xml 2007-08-17
18:22:12 UTC (rev 7984)
@@ -38,14 +38,34 @@
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
<managed-bean>
+ <managed-bean-name>sendmailmgr</managed-bean-name>
+
<managed-bean-class>org.jboss.portal.core.identity.ui.common.SendMailBean</managed-bean-class>
+ <managed-bean-scope>application</managed-bean-scope>
+ <!--
+ Mail Preferences
+ -->
+ <managed-property>
+ <property-name>emailDomain</property-name>
+ <value>Portal.com</value>
+ </managed-property>
+ <managed-property>
+ <property-name>emailFrom</property-name>
+ <value>no-reply(a)portal.com</value>
+ </managed-property>
+ <!-- -->
+ </managed-bean>
+ <managed-bean>
<managed-bean-name>identityrolemgr</managed-bean-name>
<managed-bean-class>org.jboss.portal.core.identity.ui.common.IdentityRoleBean</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
- <!-- defaultRole -->
+ <!--
+ defaultRole
+ -->
<managed-property>
<property-name>defaultRole</property-name>
<value>User</value>
</managed-property>
+ <!-- -->
<managed-property>
<property-name>roleModule</property-name>
<value>#{applicationScope.RoleModule}</value>
@@ -86,26 +106,30 @@
<property-name>identityUserBean</property-name>
<value>#{identityusermgr}</value>
</managed-property>
+ <managed-property>
+ <property-name>sendMailBean</property-name>
+ <value>#{sendmailmgr}</value>
+ </managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>userregistermgr</managed-bean-name>
<managed-bean-class>org.jboss.portal.core.identity.ui.actions.CreateUserAction</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
+ <!--
+ subscriptionMode
+ -->
<managed-property>
<property-name>subscriptionMode</property-name>
<value>emailVerification</value>
</managed-property>
+ <!-- -->
<managed-property>
- <property-name>emailDomain</property-name>
- <value>Jboss.com</value>
- </managed-property>
- <managed-property>
<property-name>identityUserBean</property-name>
<value>#{identityusermgr}</value>
</managed-property>
<managed-property>
- <property-name>mailModule</property-name>
- <value>#{applicationScope.MailModule}</value>
+ <property-name>sendMailBean</property-name>
+ <value>#{sendmailmgr}</value>
</managed-property>
</managed-bean>
<managed-bean>
@@ -156,6 +180,21 @@
<managed-bean-name>lostpasswordmgr</managed-bean-name>
<managed-bean-class>org.jboss.portal.core.identity.ui.actions.LostPasswordAction</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
+ <!--
+ Characters used in the generated password
+ -->
+ <managed-property>
+ <property-name>passwordCharacters</property-name>
+
<value>0123456789aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWyYzZ*#!+-/"</value>
+ </managed-property>
+ <managed-property>
+ <property-name>identityUserBean</property-name>
+ <value>#{identityusermgr}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>sendMailBean</property-name>
+ <value>#{sendmailmgr}</value>
+ </managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>createrolemgr</managed-bean-name>
@@ -197,6 +236,13 @@
</navigation-case>
</navigation-rule>
<navigation-rule>
+ <from-view-id>/WEB-INF/jsf/lostPassword/lost.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>status</from-outcome>
+ <to-view-id>/WEB-INF/jsf/lostPassword/status.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
<navigation-case>
<from-outcome>register</from-outcome>
<to-view-id>/WEB-INF/jsf/register/register.xhtml</to-view-id>
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/index.xhtml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/index.xhtml 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/index.xhtml 2007-08-17
18:22:12 UTC (rev 7984)
@@ -48,6 +48,11 @@
<h:outputText value="#{bundle.IDENTITY_ENABLED}"/>
</f:facet>
<h:selectBooleanCheckbox id="enabled"
value="#{uiUser.attribute.enabled}" disabled="true" />
+ <h:commandLink action="#{useradministrationbean.enableUser}">
+ <h:outputText value="#{uiUser.attribute.enabled == true ? 'disable' :
'enable'}" />
+ <f:param name="currentUser" value="#{uiUser.username}"/>
+ <f:param name="enableAction" value="#{uiUser.attribute.enabled ==
true ? 'disable' : 'enable'}" />
+ </h:commandLink>
</h:column>
<h:column>
<f:facet name="header">
@@ -68,7 +73,6 @@
</h:column>
</h:dataTable>
- <h:messages />
<p style="text-align: right"><h:commandLink
value="#{bundle.IDENTITY_MANAGEMENT_CREATE_USER}"
action="createUser"/></p>
</ui:define>
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/registerRoles.xhtml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/registerRoles.xhtml 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/registerRoles.xhtml 2007-08-17
18:22:12 UTC (rev 7984)
@@ -15,7 +15,7 @@
<ui:define name="content">
<h:form>
<h:selectManyCheckbox id="roles"
value="#{userregistermgr.roles}">
- <f:selectItems value="#{rolemanagementbean.roleSelectItems}" />
+ <f:selectItems value="#{identityrolemgr.roleSelectItems}" />
</h:selectManyCheckbox>
<hr/>
<h:commandButton value="Submit" action="register"
styleClass="portlet-form-button"/>
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/userTemplate.xhtml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/userTemplate.xhtml 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/userTemplate.xhtml 2007-08-17
18:22:12 UTC (rev 7984)
@@ -18,7 +18,7 @@
</h:form>
<!-- Status message -->
- <h:message infoClass="portlet-msg-success"
errorClass="portlet-msg-error" fatalClass="portlet-msg-error"
warnClass="portlet-msg-alert"/>
+ <h:messages infoClass="portlet-msg-success"
errorClass="portlet-msg-error" fatalClass="portlet-msg-error"
warnClass="portlet-msg-alert"/>
<!-- Title -->
<h4><ui:insert name="title">Title</ui:insert></h4>
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/profile.xhtml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/profile.xhtml 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/profile.xhtml 2007-08-17
18:22:12 UTC (rev 7984)
@@ -6,19 +6,15 @@
xmlns:c="http://java.sun.com/jstl/core"
class="identity-ui">
+ <h:panelGrid columns="2">
+ <h:outputText for="username"
value="#{bundle.IDENTITY_USERNAME}"/>
+ <h:outputText id="username"
value="#{manager.uiUser.username}"/>
+
+ <h:outputText for="email" value="#{bundle.IDENTITY_EMAIL}"/>
+ <h:outputText id="email"
value="#{manager.uiUser.attribute.email}"/>
+ </h:panelGrid>
<ul class="topnav">
- <li
id="currentTab"><b>#{bundle.IDENTITY_EDIT_PROFILE_TITLE}</b></li>
- </ul>
-
- <h:outputText for="username"
value="#{bundle.IDENTITY_USERNAME}"/>:
- <h:outputText id="username"
value="#{manager.uiUser.username}"/>
- <br/>
- <h:outputText for="email" value="#{bundle.IDENTITY_EMAIL}"/>:
- <h:outputText id="email"
value="#{manager.uiUser.attribute.email}"/>
- <br/>
-
- <ul class="topnav">
<li id="currentTab">Personal Information</li>
</ul>
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/lostPassword/lost.xhtml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/lostPassword/lost.xhtml 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/lostPassword/lost.xhtml 2007-08-17
18:22:12 UTC (rev 7984)
@@ -15,15 +15,10 @@
<h:form>
<p>#{bundle.IDENTITY_LOST_PASSWORD_DESCRIPTION}</p>
<h:panelGrid columns="3" cellpadding="3">
- <h:outputText for="username"
value="#{bundle.IDENTITY_USERNAME}"/>
- <h:inputText id="username" value="#{lostpasswordmgr.username}"
/>
- <h:message for="username" />
-
- <h:outputText for="email" value="#{bundle.IDENTITY_EMAIL}"/>
- <h:inputText id="email" value="#{lostpasswordmgr.email}" />
- <h:message for="email"/>
+ <h:outputText for="username"
value="#{bundle.IDENTITY_USERNAME}"/>
+ <h:inputText id="username" value="#{lostpasswordmgr.username}"
/>
+ <h:message for="username" />
</h:panelGrid>
- <h:message />
<hr/>
<h:commandButton value="#{bundle.IDENTITY_BUTTON_SUBMIT}"
action="#{lostpasswordmgr.doomed}"
styleClass="portlet-form-button"/>
</h:form>
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/lostPassword/lostTemplate.xhtml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/lostPassword/lostTemplate.xhtml 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/lostPassword/lostTemplate.xhtml 2007-08-17
18:22:12 UTC (rev 7984)
@@ -23,7 +23,7 @@
</h:form>
<!-- Status message -->
- <h:message infoClass="portlet-msg-success"
errorClass="portlet-msg-error" fatalClass="portlet-msg-error"
warnClass="portlet-msg-alert"/>
+ <h:messages infoClass="portlet-msg-success"
errorClass="portlet-msg-error" fatalClass="portlet-msg-error"
warnClass="portlet-msg-alert"/>
<!-- Title -->
<h4><ui:insert name="title">Title</ui:insert></h4>
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/lostPassword/status.xhtml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/lostPassword/status.xhtml 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/lostPassword/status.xhtml 2007-08-17
18:22:12 UTC (rev 7984)
@@ -0,0 +1,15 @@
+<div
+
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:c="http://java.sun.com/jstl/core"
+ class="identity-ui">
+
+<ui:composition template="/WEB-INF/jsf/lostPassword/lostTemplate.xhtml">
+
+<ui:define name="title" />
+<ui:define name="content" />
+</ui:composition>
+</div>
+
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/register/overview.xhtml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/register/overview.xhtml 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/register/overview.xhtml 2007-08-17
18:22:12 UTC (rev 7984)
@@ -12,7 +12,7 @@
#{bundle.IDENTITY_NOT_LOGGED_IN}
</ui:define>
<ui:define name="content">
- <h:commandLink value="#{bundle.IDENTITY_CREATE_ACCOUNT}"
action="register"/>
+ <p><h:commandLink value="#{bundle.IDENTITY_CREATE_ACCOUNT}"
action="register"/></p>
</ui:define>
</ui:composition>
</div>
\ No newline at end of file
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/portlet-instances.xml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/portlet-instances.xml 2007-08-17
15:41:47 UTC (rev 7983)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/portlet-instances.xml 2007-08-17
18:22:12 UTC (rev 7984)
@@ -37,6 +37,12 @@
<instance>
<instance-id>CoreIdentityAdminPortletInstance</instance-id>
<portlet-ref>CoreIdentityAdminPortlet</portlet-ref>
+ <security-constraint>
+ <policy-permission>
+ <role-name>Admin</role-name>
+ <action-name>view</action-name>
+ </policy-permission>
+ </security-constraint>
</instance>
</deployment>
</deployments>
\ No newline at end of file
Modified: trunk/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml 2007-08-17
15:41:47 UTC (rev 7983)
+++ trunk/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml 2007-08-17
18:22:12 UTC (rev 7984)
@@ -42,6 +42,10 @@
<name>defaultRole</name>
<value>User</value>
</init-param>
+ <init-param>
+ <name>subscriptionMode</name>
+ <value>test</value>
+ </init-param>
<expiration-cache>-1</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
@@ -67,6 +71,10 @@
<name>defaultRole</name>
<value>User</value>
</init-param>
+ <init-param>
+ <name>subscriptionMode</name>
+ <value>test</value>
+ </init-param>
<expiration-cache>-1</expiration-cache>
<supports>
<mime-type>text/html</mime-type>