From 5c3b0b2339ce3450b15c4d68660f972b981f6db4 Mon Sep 17 00:00:00 2001 From: Nicolas Michard Date: Tue, 5 Feb 2008 14:35:18 +0000 Subject: [PATCH] =?UTF-8?q?UserRegistration=20ok,=20modification=20donn?= =?UTF-8?q?=C3=A9e=20/=20pass,=20reste=20bug=20cache=20password?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WEB-INF/classes/messages.properties | 1 + YACOSWeb/WebContent/WEB-INF/jsp/registerUser.jsp | 13 +++++++++---- YACOSWeb/WebContent/login.jsp | 4 ++-- .../controller/SUserRegistrationController.java | 16 +++++++++++----- .../src/org/yacos/web/system/form/FormUser.java | 2 +- 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/YACOSWeb/WebContent/WEB-INF/classes/messages.properties b/YACOSWeb/WebContent/WEB-INF/classes/messages.properties index 7e82e9f..261c902 100644 --- a/YACOSWeb/WebContent/WEB-INF/classes/messages.properties +++ b/YACOSWeb/WebContent/WEB-INF/classes/messages.properties @@ -15,6 +15,7 @@ login.label.login=Login login.label.password=Password login.label.rememberme=Remember me login.label.connexion=Connexion +login.label.inscription=New user ? Create an account here login.label.alreadyaccount:I have already an account # New user login.label.createnewuser=Create an account diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/registerUser.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/registerUser.jsp index c3e04c7..4d10b85 100644 --- a/YACOSWeb/WebContent/WEB-INF/jsp/registerUser.jsp +++ b/YACOSWeb/WebContent/WEB-INF/jsp/registerUser.jsp @@ -8,11 +8,16 @@ -

+ +

+
+ +

+
+

- -

-

+

+





diff --git a/YACOSWeb/WebContent/login.jsp b/YACOSWeb/WebContent/login.jsp index 9b2c283..74f857b 100644 --- a/YACOSWeb/WebContent/login.jsp +++ b/YACOSWeb/WebContent/login.jsp @@ -3,9 +3,9 @@ -
- : +
+ : diff --git a/YACOSWeb/src/org/yacos/web/system/controller/SUserRegistrationController.java b/YACOSWeb/src/org/yacos/web/system/controller/SUserRegistrationController.java index e7ab640..b0493d1 100644 --- a/YACOSWeb/src/org/yacos/web/system/controller/SUserRegistrationController.java +++ b/YACOSWeb/src/org/yacos/web/system/controller/SUserRegistrationController.java @@ -6,6 +6,7 @@ package org.yacos.web.system.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.acegisecurity.providers.dao.UserCache; import org.springframework.validation.BindException; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.SimpleFormController; @@ -59,13 +60,18 @@ public class SUserRegistrationController extends SimpleFormController { user.setFirstName(userCommand.getFirstName()); user.setLastName(userCommand.getLastName()); user.setOrganization(userCommand.getOrganization()); + + if(userCommand.passwordWasModified()){ + user.setPassword(User.hashPassword(userCommand.getPassword())); + } + + userManager.UpdateUser(user); + + // Empty cache + //UserCache.removeUserFromCache(user.getLogin()); + } - if(userCommand.passwordWasModified()){ - user.setPassword(userCommand.getPassword()); - } - - return new ModelAndView(new RedirectView(getSuccessView())); } diff --git a/YACOSWeb/src/org/yacos/web/system/form/FormUser.java b/YACOSWeb/src/org/yacos/web/system/form/FormUser.java index e5ad68f..06466a1 100644 --- a/YACOSWeb/src/org/yacos/web/system/form/FormUser.java +++ b/YACOSWeb/src/org/yacos/web/system/form/FormUser.java @@ -121,7 +121,7 @@ public class FormUser { this.organization = organization; } public boolean passwordWasModified() { - return this.passwordPlaceholderValue.equals(this.getPassword()); + return ! this.passwordPlaceholderValue.equals(this.getPassword()); } public boolean passwordsMatches() { return this.password.equals(this.passwordConfirm);