bug submit form user registration
bug cache password jstl fn: ajoute mise en forme user registration + message ok/maj retablissement de l'ancien acegicontext.xml
This commit is contained in:
@@ -81,7 +81,12 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem
|
||||
<!-- </property>-->
|
||||
</bean>
|
||||
|
||||
<bean id="accessDecisionManager" class="org.acegisecurity.vote.AffirmativeBased">
|
||||
|
||||
<!-- AUTHORIZATION SERVICES -->
|
||||
<bean id="filterInvocationInterceptor" class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">
|
||||
<property name="authenticationManager" ref="authenticationManager"/>
|
||||
<property name="accessDecisionManager">
|
||||
<bean class="org.acegisecurity.vote.AffirmativeBased">
|
||||
<property name="allowIfAllAbstainDecisions" value="false"/>
|
||||
<property name="decisionVoters">
|
||||
<list>
|
||||
@@ -90,11 +95,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- AUTHORIZATION SERVICES -->
|
||||
<bean id="filterInvocationInterceptor" class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">
|
||||
<property name="authenticationManager" ref="authenticationManager"/>
|
||||
<property name="accessDecisionManager" ref="accessDecisionManager"/>
|
||||
</property>
|
||||
<property name="objectDefinitionSource">
|
||||
<value>
|
||||
CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
|
||||
@@ -106,18 +107,6 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="SecurityAnnotationAttributes" class="org.acegisecurity.annotation.SecurityAnnotationAttributes"/>
|
||||
<bean id="MethodDefinitionAttributes" class="org.acegisecurity.intercept.method.MethodDefinitionAttributes">
|
||||
<property name="attributes"><ref local="SecurityAnnotationAttributes"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="methodInvocationInterceptor" class="org.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
|
||||
<property name="validateConfigAttributes"><value>true</value></property>
|
||||
<property name="authenticationManager" ref="authenticationManager"/>
|
||||
<property name="accessDecisionManager" ref="accessDecisionManager"/>
|
||||
<property name="objectDefinitionSource" ref="MethodDefinitionAttributes"/>
|
||||
</bean>
|
||||
|
||||
<!-- LOGOUT -->
|
||||
<bean id="logoutFilter" class="org.acegisecurity.ui.logout.LogoutFilter">
|
||||
<constructor-arg value="/index.jsp"/>
|
||||
|
||||
@@ -86,7 +86,15 @@ form.register.error.firstNameEmpty=First name is required
|
||||
form.register.error.lastNameEmpty=Last name is required
|
||||
form.register.error.passwordEmpty=The password can't be empty
|
||||
form.register.error.alreadyExists=A user with this login already exists. Please check you haven't already registered or change your login.
|
||||
|
||||
form.link.back=Back
|
||||
form.label.newaccount=You want post an article and participate at one conference ? so create your account !
|
||||
form.label.message=NOTE: you have already an account ? Please connect you to the
|
||||
form.label.linkPage=opening session page
|
||||
form.field.account=Your account
|
||||
form.field.personal=Personal details
|
||||
form.field.necessary=* Required informations
|
||||
message.account.validate=Account created successfully. You can now connect at this.
|
||||
message.account.maj=Your account was indeed updated.
|
||||
|
||||
###################
|
||||
# FORGOT USER
|
||||
|
||||
@@ -3,3 +3,4 @@
|
||||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="authz" uri="http://acegisecurity.org/authz" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
@@ -6,6 +6,15 @@
|
||||
|
||||
<h4 class="title">Conference's list</h4>
|
||||
|
||||
<c:if test="${ac != null}">
|
||||
<p class="formHelp">
|
||||
<c:choose>
|
||||
<c:when test="${ac == 2}"><fmt:message key="message.account.validate" /></c:when>
|
||||
<c:when test="${ac == 1}"><fmt:message key="message.account.maj" /></c:when>
|
||||
</c:choose>
|
||||
</p>
|
||||
</c:if>
|
||||
|
||||
<c:if test="${errorMessage != null}">
|
||||
<div class="errorBox">
|
||||
<c:choose>
|
||||
@@ -41,7 +50,9 @@
|
||||
${conference.title} - In this conference you are:
|
||||
<c:forEach items="${listRole}" var="role">
|
||||
<c:if test="${conference.id == role.conference.id}">
|
||||
${role.type}
|
||||
|
||||
${fn:toLowerCase(role.type)}
|
||||
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:when>
|
||||
|
||||
@@ -5,33 +5,76 @@
|
||||
<body>
|
||||
|
||||
<h4 class="title"><fmt:message key="register.title" /></h4>
|
||||
<form:form method="post" commandName="registerUser">
|
||||
|
||||
<div class="user_new">
|
||||
<fmt:message key="form.label.newaccount" />
|
||||
</div>
|
||||
<fmt:message key="form.label.message" />
|
||||
<a href="<c:url value="login.htm"/>" /><fmt:message key="form.label.linkPage" /></a>
|
||||
<br />
|
||||
<form:form method="post" commandName="registerUser" id="account_data">
|
||||
<form:hidden path="isNew"/>
|
||||
|
||||
<authz:authorize ifAllGranted="ROLE_ANONYMOUS">
|
||||
<form:label path="login"><fmt:message key="form.register.user.login" /></form:label> <form:input path="login" disabled="false" /> <span class="formError"><form:errors path="login" /></span><br/><br />
|
||||
</authz:authorize>
|
||||
<p class="legend"><fmt:message key="form.field.account" /></p>
|
||||
<fieldset>
|
||||
<span class="info"><fmt:message key="form.field.necessary" /></span>
|
||||
<div>
|
||||
<form:label path="login"><fmt:message key="form.register.user.login" /></form:label>
|
||||
<authz:authorize ifNotGranted="ROLE_ANONYMOUS">
|
||||
<form:label path="login"><fmt:message key="form.register.user.login" /></form:label> <form:input path="login" disabled="true"/> <span class="formError"><form:errors path="login" /></span><br/><br />
|
||||
<form:input path="login" disabled="true"/>*
|
||||
</authz:authorize>
|
||||
<authz:authorize ifAllGranted="ROLE_ANONYMOUS">
|
||||
<form:input path="login" disabled="false"/>*
|
||||
</authz:authorize>
|
||||
<span class="formError"><form:errors path="login" /></span>
|
||||
</div>
|
||||
<div>
|
||||
<form:label path="password"><fmt:message key="form.register.user.password" /></form:label>
|
||||
<form:password path="password" showPassword="true"/>*
|
||||
<span class="formError"><form:errors path="password" /></span>
|
||||
</div>
|
||||
<div>
|
||||
<form:label path="passwordConfirm"><fmt:message key="form.register.user.passwordConfirm" /></form:label>
|
||||
<form:password path="passwordConfirm" showPassword="true"/>*
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<form:label path="email"><fmt:message key="form.register.user.email" /></form:label> <form:input path="email"/> <span class="formError"><form:errors path="email" /></span><br/><br />
|
||||
<form:label path="password"><fmt:message key="form.register.user.password" /></form:label> <form:password path="password" showPassword="true"/> <span class="formError"><form:errors path="password" /></span><br/><br />
|
||||
<form:label path="passwordConfirm"><fmt:message key="form.register.user.passwordConfirm" /></form:label> <form:password path="passwordConfirm" showPassword="true"/><br/><br />
|
||||
<p class="legend"><fmt:message key="form.field.personal" /></p>
|
||||
|
||||
<form:label path="firstName"><fmt:message key="form.register.user.firstName" /></form:label> <form:input path="firstName"/> <span class="formError"><form:errors path="firstName" /></span><br/><br />
|
||||
<form:label path="lastName"><fmt:message key="form.register.user.lastName" /></form:label> <form:input path="lastName"/> <span class="formError"><form:errors path="lastName" /></span><br/><br />
|
||||
<form:label path="organization"><fmt:message key="form.register.user.organization" /></form:label> <form:input path="organization"/> <span class="formError"><form:errors path="organization" /></span><br/><br />
|
||||
<fieldset>
|
||||
<div>
|
||||
<form:label path="firstName"><fmt:message key="form.register.user.firstName" /></form:label>
|
||||
<form:input path="firstName"/>*
|
||||
<span class="formError"><form:errors path="firstName" /></span>
|
||||
</div>
|
||||
<div>
|
||||
<form:label path="lastName"><fmt:message key="form.register.user.lastName" /></form:label>
|
||||
<form:input path="lastName"/>*
|
||||
<span class="formError"><form:errors path="lastName" /></span>
|
||||
</div>
|
||||
<div>
|
||||
<form:label path="email"><fmt:message key="form.register.user.email" /></form:label>
|
||||
<form:input path="email"/>*
|
||||
<span class="formError"><form:errors path="email" /></span>
|
||||
</div>
|
||||
<div>
|
||||
<form:label path="organization"><fmt:message key="form.register.user.organization" /></form:label>
|
||||
<form:input path="organization"/>
|
||||
<span class="formError"><form:errors path="organization" /></span>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<center>
|
||||
<a class="back_link" href="<c:url value="login.htm"/>">
|
||||
<fmt:message key="form.link.back" />
|
||||
</a>
|
||||
|
||||
<a class="register_link" href="javascript:document.getElementById('account_data').submit();">
|
||||
<fmt:message key="login.label.continue" />
|
||||
</a>
|
||||
|
||||
<input type="reset" value="<fmt:message key="button.reset" />"/>
|
||||
<input type="submit" value="<fmt:message key="button.OK" />"/> <br/><br/>
|
||||
</center>
|
||||
</form:form>
|
||||
|
||||
|
||||
|
||||
<a href="<c:url value="main.htm"/>">Home</a>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -76,7 +76,6 @@
|
||||
<property name="commandClass"
|
||||
value="org.yacos.web.system.form.FormUser" />
|
||||
<property name="formView" value="registerUser" />
|
||||
<property name="successView" value="listConference.htm" />
|
||||
<property name="userManager" ref="userManager" />
|
||||
<property name="validator" ref="UserValidator"/>
|
||||
</bean>
|
||||
|
||||
BIN
YACOSWeb/WebContent/images/button_back_32x32.gif
Normal file
BIN
YACOSWeb/WebContent/images/button_back_32x32.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
@@ -23,6 +23,14 @@ body {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
a{
|
||||
color: #8d0000;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover{
|
||||
color: #ea984b;
|
||||
}
|
||||
|
||||
.login_error {
|
||||
color: #ff0000;
|
||||
font-size: 10px;
|
||||
@@ -203,7 +211,7 @@ form > table > thead th {
|
||||
}
|
||||
|
||||
#maincontent {
|
||||
color: #333;
|
||||
color: #847d7d;
|
||||
}
|
||||
|
||||
|
||||
@@ -276,6 +284,7 @@ table.content_table {
|
||||
|
||||
/* @end */
|
||||
|
||||
|
||||
/* @group mainmenu */
|
||||
|
||||
#main #mainmenu {
|
||||
@@ -361,6 +370,80 @@ table.content_table {
|
||||
|
||||
/* @end */
|
||||
|
||||
/* @group account data form */
|
||||
#account_data p.legend {
|
||||
font-weight:bold;
|
||||
margin:10px 0px 3px 0px;
|
||||
}
|
||||
#account_data fieldset {
|
||||
background-color: #fff8e1;
|
||||
border: 1px solid #ffe7b3;
|
||||
margin-right: 0px;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 5px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
#account_data fieldset span.info {
|
||||
float:right;
|
||||
position:relative;
|
||||
margin:-16px -10px 0px 0px;
|
||||
font-size:11px;
|
||||
}
|
||||
#account_data fieldset div {
|
||||
line-height:25px;
|
||||
width: 700px;
|
||||
}
|
||||
|
||||
#account_data fieldset div div{
|
||||
line-height:25px;
|
||||
width: 700px;
|
||||
}
|
||||
|
||||
#account_data fieldset div label {
|
||||
display:block;
|
||||
float:left;
|
||||
width:195px;
|
||||
}
|
||||
#account_data fieldset div input {
|
||||
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
|
||||
color:#847d6e;
|
||||
font-size:11px;
|
||||
width:130px;
|
||||
}
|
||||
|
||||
#account_data input:focus {
|
||||
background-color: #fefed7;
|
||||
}
|
||||
|
||||
#account_data fieldset div span {
|
||||
color: #f00;
|
||||
}
|
||||
|
||||
a.back_link {
|
||||
text-decoration: none;
|
||||
padding-left: 50px;
|
||||
background: url(../images/button_back_32x32.gif) no-repeat left top;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
color: #008281;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
a.back_link:hover{
|
||||
color: #003e82;
|
||||
}
|
||||
|
||||
div.user_new {
|
||||
color: #847d6e;
|
||||
font-weight: bold;
|
||||
background: url(../images/user_new.png) no-repeat left top;
|
||||
padding-left: 60px;
|
||||
height: 40px;
|
||||
padding-top: 15px;
|
||||
}
|
||||
/* @end */
|
||||
|
||||
/* @group globalfooter */
|
||||
|
||||
#globalfooter {
|
||||
|
||||
@@ -58,6 +58,13 @@ public class ListConferenceController implements Controller{
|
||||
model.put("errorMessage", msgCode);
|
||||
}
|
||||
|
||||
// Create User before
|
||||
String msgAccount = request.getParameter("account");
|
||||
if (msgAccount != null)
|
||||
{
|
||||
model.put("ac", msgAccount);
|
||||
}
|
||||
|
||||
|
||||
return new ModelAndView("listConference", model);
|
||||
}
|
||||
|
||||
@@ -3,11 +3,18 @@
|
||||
*/
|
||||
package org.yacos.web.system.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.acegisecurity.providers.dao.DaoAuthenticationProvider;
|
||||
import org.acegisecurity.providers.dao.UserCache;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.SimpleFormController;
|
||||
import org.springframework.web.servlet.support.RequestContextUtils;
|
||||
import org.springframework.web.servlet.view.RedirectView;
|
||||
import org.yacos.core.exceptions.PKAlreadyUsedException;
|
||||
import org.yacos.core.exceptions.UserEMailAlreadyExistsException;
|
||||
@@ -36,6 +43,7 @@ public class SUserRegistrationController extends SimpleFormController {
|
||||
|
||||
// Tries to retrieve the current user : case of user modification
|
||||
User user = SessionService.getInstance().getCurrentUser();
|
||||
Map<String, Object> model = new HashMap<String, Object>();
|
||||
|
||||
if( userCommand.getIsNew() ){
|
||||
try {
|
||||
@@ -46,6 +54,7 @@ public class SUserRegistrationController extends SimpleFormController {
|
||||
userCommand.getLastName(),
|
||||
userCommand.getOrganization(),
|
||||
userCommand.getEmail());
|
||||
model.put("account", "2");
|
||||
} catch (PKAlreadyUsedException e) {
|
||||
errors.rejectValue("login", "form.register.error.alreadyExists");
|
||||
return new ModelAndView(new RedirectView(getFormView()));
|
||||
@@ -61,16 +70,17 @@ public class SUserRegistrationController extends SimpleFormController {
|
||||
|
||||
if(userCommand.passwordWasModified()){
|
||||
user.setPassword(User.hashPassword(userCommand.getPassword()));
|
||||
}
|
||||
|
||||
// Empty cache for the new password
|
||||
DaoAuthenticationProvider authProvider = (DaoAuthenticationProvider) RequestContextUtils.getWebApplicationContext(request).getBean("daoAuthenticationProvider");
|
||||
UserCache userCache = authProvider.getUserCache();
|
||||
userCache.removeUserFromCache(user.getLogin());
|
||||
}
|
||||
userManager.UpdateUser(user);
|
||||
|
||||
// Empty cache
|
||||
//UserCache.removeUserFromCache(user.getLogin());
|
||||
|
||||
model.put("account", "1");
|
||||
}
|
||||
|
||||
return new ModelAndView(new RedirectView(getSuccessView()));
|
||||
return new ModelAndView(new RedirectView("listConference.htm"), model);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,6 +98,9 @@ public class SUserRegistrationController extends SimpleFormController {
|
||||
if(SessionService.getInstance().isUserLogged()){
|
||||
// If he is logged, we use his profile information to fill the form
|
||||
currentUser = (User) SessionService.getInstance().getCurrentUser();
|
||||
// fill password field
|
||||
user.setPasswordForRegisteredUser();
|
||||
|
||||
user.setIsNew(false);
|
||||
}
|
||||
|
||||
@@ -97,6 +110,8 @@ public class SUserRegistrationController extends SimpleFormController {
|
||||
user.setEmail(currentUser.getEmail());
|
||||
user.setOrganization(currentUser.getOrganization());
|
||||
|
||||
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,14 +24,13 @@ public class FormUser {
|
||||
public FormUser() {
|
||||
this.login = "";
|
||||
this.email = "";
|
||||
|
||||
// We can't use the real password of the user, so we generate
|
||||
// a hopefully unique placeholder value, that we will be able to check for modification at validation
|
||||
Random placeholderSeed = new Random(new Date().getTime());
|
||||
this.passwordPlaceholderValue = "placeholder"+placeholderSeed.nextInt();
|
||||
|
||||
this.password = this.passwordPlaceholderValue;
|
||||
this.passwordConfirm = this.passwordPlaceholderValue;
|
||||
// For registration password="" but for editing call setPasswordForRegisteredUser method.
|
||||
this.password = "";
|
||||
this.passwordConfirm = "";
|
||||
this.firstName = "";
|
||||
this.lastName = "";
|
||||
this.organization = "";
|
||||
@@ -135,4 +134,10 @@ public class FormUser {
|
||||
return isNew;
|
||||
}
|
||||
|
||||
public void setPasswordForRegisteredUser() {
|
||||
|
||||
this.password = this.passwordPlaceholderValue;
|
||||
this.passwordConfirm = this.passwordPlaceholderValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user