[jboss-svn-commits] JBL Code SVN: r33669 - in labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src: main/plugin and 2 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Jun 28 07:09:02 EDT 2010
Author: lkrzyzanek
Date: 2010-06-28 07:09:02 -0400 (Mon, 28 Jun 2010)
New Revision: 33669
Added:
labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main/java/org/jboss/labs/sbs/plugin/nukesauth/struts/CreateNewJBossUserAccountAction.java
labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/test/java/org/jboss/labs/sbs/plugin/nukesauth/struts/
labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/test/java/org/jboss/labs/sbs/plugin/nukesauth/struts/CreateNewJBossUserAccountActionTest.java
Modified:
labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main/plugin/struts.xml
Log:
Added new struts action for Create New JBoss User with additional validationi on @ character.
Added: labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main/java/org/jboss/labs/sbs/plugin/nukesauth/struts/CreateNewJBossUserAccountAction.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main/java/org/jboss/labs/sbs/plugin/nukesauth/struts/CreateNewJBossUserAccountAction.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main/java/org/jboss/labs/sbs/plugin/nukesauth/struts/CreateNewJBossUserAccountAction.java 2010-06-28 11:09:02 UTC (rev 33669)
@@ -0,0 +1,41 @@
+/*
+ * JBoss Community http://jboss.org/
+ *
+ * Copyright (c) 2010 Red Hat Middleware, LLC. All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT A 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, v.2.1 along with this distribution; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ * Red Hat Author(s): Libor Krzyzanek
+ */
+package org.jboss.labs.sbs.plugin.nukesauth.struts;
+
+import com.jivesoftware.community.action.CreateNewUserAccountAction;
+
+/**
+ * Extension of {@link CreateNewUserAccountAction}. Provides additional
+ * validation e.g. on username
+ *
+ * @author <a href="mailto:lkrzyzan at redhat.com">Libor Krzyzanek</a>
+ */
+public class CreateNewJBossUserAccountAction extends CreateNewUserAccountAction {
+
+ /**
+ * Add validation on @ character. User cannot put his e-mail.
+ */
+ @Override
+ protected boolean usernameInvalid(String username) {
+ return super.usernameInvalid(username) || username.indexOf('@') != -1;
+ }
+}
Property changes on: labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main/java/org/jboss/labs/sbs/plugin/nukesauth/struts/CreateNewJBossUserAccountAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main/plugin/struts.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main/plugin/struts.xml 2010-06-28 10:24:07 UTC (rev 33668)
+++ labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main/plugin/struts.xml 2010-06-28 11:09:02 UTC (rev 33669)
@@ -74,7 +74,8 @@
<result name="success">/template/global/reset-password.ftl</result>
</action>
- <action name="edit-jboss-profile" class="org.jboss.labs.sbs.plugin.nukesauth.struts.EditJBossProfile">
+ <action name="edit-jboss-profile"
+ class="org.jboss.labs.sbs.plugin.nukesauth.struts.EditJBossProfile">
<interceptor-ref name="paramsPrepareParamsStack" />
<interceptor-ref name="token">
<param name="excludeMethods">input,cancel</param>
@@ -84,6 +85,21 @@
<result name="success" type="redirect">${redirect}</result>
</action>
+ <!-- Based on spring-community.xml:1011 -->
+ <action name="create-jboss-account"
+ class="org.jboss.labs.sbs.plugin.nukesauth.struts.CreateNewJBossUserAccountAction"
+ method="input">
+ <result name="unavailable">/template/global/registration-unavailable.ftl
+ </result>
+ <result name="cancel" type="redirect">index.jspa</result>
+ <result name="not-authorized" type="redirect">login.jspa</result>
+ <result name="input">/template/global/create-account.ftl</result>
+ <result name="success" type="redirect">index.jspa</result>
+ <result name="success-wizard" type="redirect">user-wizard-profile!input.jspa
+ </result>
+ <result name="success-pending" type="redirect">account-pending.jspa
+ </result>
+ </action>
</package>
Added: labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/test/java/org/jboss/labs/sbs/plugin/nukesauth/struts/CreateNewJBossUserAccountActionTest.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/test/java/org/jboss/labs/sbs/plugin/nukesauth/struts/CreateNewJBossUserAccountActionTest.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/test/java/org/jboss/labs/sbs/plugin/nukesauth/struts/CreateNewJBossUserAccountActionTest.java 2010-06-28 11:09:02 UTC (rev 33669)
@@ -0,0 +1,19 @@
+package org.jboss.labs.sbs.plugin.nukesauth.struts;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class CreateNewJBossUserAccountActionTest {
+
+ @Test
+ public void testUsernameInvalidString() {
+ CreateNewJBossUserAccountAction action = new CreateNewJBossUserAccountAction();
+ assertTrue(action.usernameInvalid("mail at mail.org"));
+ assertTrue(action.usernameInvalid("@"));
+ assertTrue(action.usernameInvalid("mail@"));
+ assertFalse(action.usernameInvalid("admin"));
+ }
+
+}
Property changes on: labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/test/java/org/jboss/labs/sbs/plugin/nukesauth/struts/CreateNewJBossUserAccountActionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the jboss-svn-commits
mailing list