reworked login and register so flow is improved and its functional!

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@442680 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jesse McConnell 2006-09-12 19:44:24 +00:00
parent f84cd0a20e
commit 938c0ac92b
6 changed files with 114 additions and 57 deletions

View File

@ -63,6 +63,11 @@ public class NewUserAction
public String createUser() public String createUser()
{ {
if ( username == null )
{
return INPUT;
}
// TODO: use commons-validator for these fields. // TODO: use commons-validator for these fields.
if ( StringUtils.isEmpty( username ) ) if ( StringUtils.isEmpty( username ) )
@ -120,7 +125,7 @@ public class NewUserAction
if ( hasActionErrors() ) if ( hasActionErrors() )
{ {
return ERROR; return INPUT;
} }
return SUCCESS; return SUCCESS;

View File

@ -127,7 +127,8 @@
<!-- plexus security actions --> <!-- plexus security actions -->
<action name="login" class="plexusSecurityLogin" method="login"> <action name="login" class="plexusSecurityLogin" method="login">
<result name="input">/WEB-INF/jsp/loginRegister.jsp</result> <result name="input">/WEB-INF/jsp/login.jsp</result>
<result name="error">/WEB-INF/jsp/login.jsp</result>
<result name="success" type="redirect-action">browse</result> <result name="success" type="redirect-action">browse</result>
</action> </action>
@ -136,7 +137,9 @@
</action> </action>
<action name="register" class="newUser" method="createUser"> <action name="register" class="newUser" method="createUser">
<result name="success" type="redirect-action">login</result> <result name="input">/WEB-INF/jsp/register.jsp</result>
<result name="success">/WEB-INF/jsp/register.jsp</result>
<result name="error">/WEB-INF/jsp/register.jsp</result>
</action> </action>
</package> </package>

View File

@ -60,9 +60,10 @@
<div id="breadcrumbs"> <div id="breadcrumbs">
<div class="xleft"> <div class="xleft">
<ww:url id="loginUrl" action="login" namespace="/" includeParams="none"/> <ww:url id="loginUrl" action="login" namespace="/" includeParams="none"/>
<ww:url id="registerUrl" action="register" namespace="/" includeParams="none"/>
<ww:if test="${sessionScope.authStatus != true}"> <ww:if test="${sessionScope.authStatus != true}">
<ww:a href="%{loginUrl}">Login/Register</ww:a> <ww:a href="%{loginUrl}">Login</ww:a> - <ww:a href="%{registerUrl}">Register</ww:a>
</ww:if> </ww:if>
<ww:else> <ww:else>

View File

@ -0,0 +1,79 @@
<%--
~ Copyright 2005-2006 The Apache Software Foundation.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
--%>
<%@ taglib prefix="ww" uri="/webwork" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<title>Login Page</title>
<ww:head/>
</head>
<body>
<div id="contentArea">
<div id="searchBox">
<div style="float: right">
<a href="#">Forgotten your Password?</a>
</div>
<p>
<ww:actionmessage/>
<ww:actionerror/>
</p>
<h2>Login</h2>
<ww:form action="login">
<table class="bodyTable">
<tr class="a">
<th>
Username
</th>
<td>
<ww:textfield name="username" size="30"/>
</td>
</tr>
<tr class="b">
<th>
Password
</th>
<td>
<ww:password name="password" size="20"/>
</td>
</tr>
<tr class="a">
<td></td>
<td>
<ww:submit value="Login"/>
</td>
</tr>
</table>
</ww:form>
</div>
</div>
<div class="clear">
<hr/>
</div>
</body>
</html>

View File

@ -19,7 +19,7 @@
<html> <html>
<head> <head>
<title>Login Page</title> <title>Registration Page</title>
<ww:head/> <ww:head/>
</head> </head>
@ -27,45 +27,12 @@
<div id="contentArea"> <div id="contentArea">
<div id="searchBox"> <div id="searchBox">
<div style="float: right">
<a href="#">Forgotten your Password?</a>
</div>
<p> <p>
<ww:actionmessage/> <ww:actionmessage/>
<ww:actionerror/>
</p> </p>
<h2>Login</h2> <h2>Register for an Account</h2>
<ww:form action="login">
<table class="bodyTable">
<tr class="a">
<th>
Username
</th>
<td>
<ww:textfield name="username" size="30"/>
</td>
</tr>
<tr class="b">
<th>
Password
</th>
<td>
<ww:password name="password" size="20"/>
</td>
</tr>
<tr class="a">
<td></td>
<td>
<ww:submit value="Login"/>
</td>
</tr>
</table>
</ww:form>
<h2>Request an Account</h2>
<ww:form action="register"> <ww:form action="register">
<table class="bodyTable"> <table class="bodyTable">
<tr class="b"> <tr class="b">
@ -82,7 +49,6 @@
</th> </th>
<td> <td>
<ww:password name="password" size="20"/> <ww:password name="password" size="20"/>
</td> </td>
</tr> </tr>
<tr class="b"> <tr class="b">
@ -109,12 +75,7 @@
</th> </th>
<td> <td>
<ww:textfield name="email" size="50 "/> <ww:textfield name="email" size="50 "/>
<br></br>
<span style="font-size: x-small">(Only administrators will be able to view this, and it will be used to
send you information about your project)
</span>
</td> </td>
</tr> </tr>
<tr class="a"> <tr class="a">
<td></td> <td></td>

View File

@ -85,19 +85,27 @@
<h2>Grant Roles</h2> <h2>Grant Roles</h2>
<p> <pss:ifAuthorized permission="grant-roles">
<table class="bodyTable">
</p>
<pss:ifAuthorized permission="grant-roles">
<ww:iterator id="role" value="availableRoles"> <ww:iterator id="role" value="availableRoles">
<ww:url id="addRoleUrl" action="assignRoleToUser">
<ww:param name="principal">${sessionScope.SecuritySessionUser.principal}</ww:param> <tr class="a">
<ww:param name="roleName">${role.name}</ww:param> <td>
</ww:url> <em>${role.name}</em><br/>
<ww:a href="%{addRoleUrl}">${role.name}</ww:a> </td>
<br/> <td>
<ww:url id="addRoleUrl" action="assignRoleToUser">
<ww:param name="principal">${sessionScope.SecuritySessionUser.principal}</ww:param>
<ww:param name="roleName">${role.name}</ww:param>
</ww:url>
<ww:a href="%{addRoleUrl}">add</ww:a>
</td>
</tr>
</ww:iterator> </ww:iterator>
</pss:ifAuthorized> </table>
</pss:ifAuthorized>
<%-- <%--
<p> <p>
This following screen needs have the various roles worked into it. This following screen needs have the various roles worked into it.