From e3f0133ffc17a9a2627adee8817bd4c8135be0b6 Mon Sep 17 00:00:00 2001 From: Christian Corsano Date: Thu, 14 Feb 2008 12:14:51 +0000 Subject: [PATCH] Ajout de l'UC ForgotPassword Modification CSS Mise en place des blocs arondis (cbb) Clarification interface pages login avec les blocs cbb Correction articleController : validation --- .../WEB-INF/classes/messages.properties | 12 +- .../WebContent/WEB-INF/decorators/main.jsp | 1 + .../WebContent/WEB-INF/jsp/forgotPassword.jsp | 28 ++++ .../WebContent/WEB-INF/jsp/listArticle.jsp | 25 ++-- .../WebContent/WEB-INF/jsp/listConference.jsp | 3 +- YACOSWeb/WebContent/WEB-INF/jsp/loginFull.jsp | 16 ++- YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml | 15 +- YACOSWeb/WebContent/images/borders.png | Bin 0 -> 136 bytes YACOSWeb/WebContent/images/box.png | Bin 0 -> 3079 bytes .../images/button_background_clic.png | Bin 0 -> 646 bytes .../images/button_background_hover.png | Bin 0 -> 135 bytes .../images/button_background_idle.png | Bin 0 -> 148 bytes YACOSWeb/WebContent/images/error_bullet.png | Bin 0 -> 1038 bytes .../WebContent/javascripts/rounded_boxes.js | 74 ++++++++++ YACOSWeb/WebContent/stylesheets/base.css | 131 +++++++++++++++++- .../author/controller/SArticleController.java | 29 ++-- .../controller/ForgotPasswordController.java | 68 +++++++++ .../SUserRegistrationController.java | 3 +- .../web/system/form/FormForgotPassword.java | 13 ++ .../yacos/web/system/session/YACOSUtils.java | 15 ++ 20 files changed, 395 insertions(+), 38 deletions(-) create mode 100644 YACOSWeb/WebContent/WEB-INF/jsp/forgotPassword.jsp create mode 100644 YACOSWeb/WebContent/images/borders.png create mode 100644 YACOSWeb/WebContent/images/box.png create mode 100644 YACOSWeb/WebContent/images/button_background_clic.png create mode 100644 YACOSWeb/WebContent/images/button_background_hover.png create mode 100644 YACOSWeb/WebContent/images/button_background_idle.png create mode 100644 YACOSWeb/WebContent/images/error_bullet.png create mode 100644 YACOSWeb/WebContent/javascripts/rounded_boxes.js create mode 100644 YACOSWeb/src/org/yacos/web/system/controller/ForgotPasswordController.java create mode 100644 YACOSWeb/src/org/yacos/web/system/form/FormForgotPassword.java create mode 100644 YACOSWeb/src/org/yacos/web/system/session/YACOSUtils.java diff --git a/YACOSWeb/WebContent/WEB-INF/classes/messages.properties b/YACOSWeb/WebContent/WEB-INF/classes/messages.properties index cb740e8..d88d4af 100644 --- a/YACOSWeb/WebContent/WEB-INF/classes/messages.properties +++ b/YACOSWeb/WebContent/WEB-INF/classes/messages.properties @@ -19,11 +19,12 @@ login.label.login=Login login.label.password=Password login.label.rememberme=Remember me login.label.register=Register -login.label.alreadyaccount:I have already an account +login.label.alreadyaccount:I already have an account # New user login.label.createnewuser=Create an account login.label.createaccount="When creating an account on Yacos.com, you may post an article and follow the conference." login.label.continue=Continue +login.label.forgotPasswordHeading=Forgot your password ? login.message.error=Your login attempt was not successful, try again. ################### @@ -87,6 +88,15 @@ 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. +################### +# FORGOT USER +form.forgotPassword.error.emailInvalid=This email is invalid +form.forgotPassword.error.unknownEmail=This email is not registered in our system +form.forgotPassword.email=E-Mail address for your account : +form.forgotPassword.submit=Request new password +form.forgotPassword.help=Please enter the email address you used for your YACOS account.\nA new password will be generated and sent into your mailbox. +forgotPassword.title=Reset your password + ################### # MESSAGE ERROR message.error.noconferenceforthisid=This conference doesn't exist. Pease try again diff --git a/YACOSWeb/WebContent/WEB-INF/decorators/main.jsp b/YACOSWeb/WebContent/WEB-INF/decorators/main.jsp index b2710ab..2ec73dd 100644 --- a/YACOSWeb/WebContent/WEB-INF/decorators/main.jsp +++ b/YACOSWeb/WebContent/WEB-INF/decorators/main.jsp @@ -11,6 +11,7 @@ <fmt:message key="title" /> + diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/forgotPassword.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/forgotPassword.jsp new file mode 100644 index 0000000..4aafbbf --- /dev/null +++ b/YACOSWeb/WebContent/WEB-INF/jsp/forgotPassword.jsp @@ -0,0 +1,28 @@ +<%@ include file="/WEB-INF/decorators/include.jsp"%> + + + + + + +

+

+ +

+
+ +

+ + + +

+ +
+ +
+ "/> +
+
+ + + \ No newline at end of file diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/listArticle.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/listArticle.jsp index 1768c54..ce14890 100644 --- a/YACOSWeb/WebContent/WEB-INF/jsp/listArticle.jsp +++ b/YACOSWeb/WebContent/WEB-INF/jsp/listArticle.jsp @@ -5,22 +5,23 @@

NO NAME

-
    -
  • ${article.title}
  • -
  • Author: ${article.mainAuthor.firstName} ${article.mainAuthor.lastName}
  • -
  • Secondary Authors: +
    +

    ${article.title}

    +

    Author: ${article.mainAuthor.firstName} ${article.mainAuthor.lastName}

    +

    + Secondary Authors:

    • ${sAuthor}
    • -
    -
  • -
  • Topic: ${article.topic}
  • -
  • - - ">Download the article
  • -
+ +

Topic: ${article.topic}

+

+ + ">Download the article +

+


diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/listConference.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/listConference.jsp index 47b9549..87545dc 100644 --- a/YACOSWeb/WebContent/WEB-INF/jsp/listConference.jsp +++ b/YACOSWeb/WebContent/WEB-INF/jsp/listConference.jsp @@ -32,7 +32,8 @@ -
+
+

${conference.title}

ID : ${conference.id}
Title : ${conference.title}
Description : ${conference.description}
diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/loginFull.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/loginFull.jsp index a3dc53b..a4cf1f8 100644 --- a/YACOSWeb/WebContent/WEB-INF/jsp/loginFull.jsp +++ b/YACOSWeb/WebContent/WEB-INF/jsp/loginFull.jsp @@ -15,11 +15,14 @@
-
+
+


- + +
- :
+
+

:

:
:
@@ -28,7 +31,12 @@

- +
+ "> + + +
+
diff --git a/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml b/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml index 7ca5419..c3c66e1 100644 --- a/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml +++ b/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml @@ -75,8 +75,10 @@ ListReportController + + + ForgotPasswordController - @@ -117,6 +119,17 @@ + + + + + + + + + DCDb50q$YKTtZeb8+WSBJvBxvR7 z;uyj)GdbY^iw_SE&l@2A1H_krcvtl#U-6pT*8l%+ujT&#-rF$p#DN0~xTijDUzO@) b&cg6ro;z^PGL7{>Qy4s5{an^LB{Ts5-u)${ literal 0 HcmV?d00001 diff --git a/YACOSWeb/WebContent/images/box.png b/YACOSWeb/WebContent/images/box.png new file mode 100644 index 0000000000000000000000000000000000000000..bfc6faaa34dee45b93c6a60b4f1a64e20147e302 GIT binary patch literal 3079 zcmb7Fc{r3^8y{<;nk?B`Oh{#mUN0qvm&wc&$~r{I79snRY0OA6)KgR$@C&5LZaeA7(VcU|8f-yh$(uIIVVx$ob(@83E1a-we=Lyz)H@&f>Xqi`6+ z6ae7WWzMzuc$t5&R?v9>fD7cVuYVh^uMfKI=k4n5=>h_OORS-Ssz}a?9!uN0bLW=_ZLiYorO)OYdhhMhQySWkHjk+ZXIgu4|bK z0+S=2oJU>|awDvt<(nyvxvjV*?V{aHPdgqxeW)Il&zHC%QJtl%9XFc>_}p9|{Eo^uM~=jWMJ_fy?I4EF99KNk78*qnE3T2o zq#5{p52*^31r`ln`mzk_yYcmaGWS8zLn$7Chvurun->!u{-+`sCO+t1rJeECnwZibYgWK)4R{hx|{pmcFkf)whkHW%K2YAA@-SLl88*)Y> zLQ&@`c&gix{FhM*wEO$6`=r2qS`ETbawjc153gfp7i-lguSwRIW!awFk>IuJ2H8w|%{1n+=+4GJ% zsCqa?D)K&Jr%k+%h)0}LoZ3<;KD%IP<91w^nFl!SexC_#D(cu zU*5>G`El)wihjL})deA<5+L8N3(@Xh@cc{HYj<;Pf>7@``YEG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chYCYx?K(8Mcq~efJy$AP((>)gy-i5QAA5 z_@&*xHwp(oga;qA+kb!3Za?@G4(!7B+HIOvXGcQ(2ywsh8Md7+J&fa-0LZ|l6R`XU zc)_ApgBoC+4FU#p5&`Qqx?&P>EYb}je zt4E9*NVUh2xp^_cYs4+ zO`WSRF2^kNx%y0@!#|m(Qv#j^>vEur3vqAO53Hh5c=#xMBn~;UOb}pbP{qSTz* zqcC`cZ2W7crkG$!jyw3=!Qk;GO%xJ`C9(y!#(N4feJlNE`eyo4`f~b@izCgkeq_tM z?zuY`?ovcydb*uxr>9uorNJ~BO%26nZ>BKOX`;KTe{rO*_hx@f|+S{jZ3|>9IXIG7VQ>ormd(Zv6P(tg#RvX9xbcE*0iUg+H@;p1@zg(0Mj#^)?@&;RS@62C0~q;kqv#&e~U%gUl@ zR6VT{&)k26|EK)}0fiL}$-4Xb00009a7bBm000XU000XU0RWnu7ytkOlu1NER2Y?Y z&LIi{VGxGlcfkeGDjvgVw|M|D?_R+sR)bBj37)~^9n1?FJ%Pn&Sa~fIewO{eHpBA` z14)EhP*@3ta1~l%K?jb6kMIxlaO0l=zLvT?6xYXATM07*qo IM6N<$g4eU@GXMYp literal 0 HcmV?d00001 diff --git a/YACOSWeb/WebContent/javascripts/rounded_boxes.js b/YACOSWeb/WebContent/javascripts/rounded_boxes.js new file mode 100644 index 0000000..a85a8a9 --- /dev/null +++ b/YACOSWeb/WebContent/javascripts/rounded_boxes.js @@ -0,0 +1,74 @@ +/* +cbb function by Roger Johansson, http://www.456bereastreet.com/ +*/ +var cbb = { + init : function() { + // Check that the browser supports the DOM methods used + if (!document.getElementById || !document.createElement || !document.appendChild) return false; + var oElement, oOuter, oI1, oI2, tempId; + // Find all elements with a class name of cbb + var arrElements = document.getElementsByTagName('*'); + var oRegExp = new RegExp("(^|\\s)cbb(\\s|$)"); + for (var i=0; i * { + display: list-item; + list-style-position: inside; + list-style-image: url(../images/error_bullet.png); } /* @group Login */ @@ -138,7 +155,6 @@ body { } #maincontent { - position: relative; color: #333; } @@ -212,13 +228,17 @@ body { padding-right: 10px; } +#maincontent > * { + margin-right: 10px; +} + #main #maincontent h4.title { color: #fff; font-weight: bold; height: 23px; - position: relative; top: 2px; margin-bottom: 6px; + margin-left: 0; } /* @end */ @@ -298,4 +318,109 @@ body { .selected { background-color: #fea752; } + +/* @end */ + +/* @group general purpose */ + +.centered { + margin: auto; +} + +/* @end */ + +/* @group rounded box */ + +.cb h2 { + margin-left: -11px; + margin-right: -11px; + padding-left: 10px; + padding-right: 10px; + border-color: #fd7738; + margin-bottom: 10px; + font-weight: bolder; + border-bottom: 2px solid #df9b7b; +} + +/* Normal styling */ +.cb { + margin:0.5em 0; +} + /* Top corners and border */ +.bt { + height:19px; + margin:0 0 0 19px; + background:url(../images/box.png) no-repeat 100% 0; +} +.bt div { + position:relative; + left:-19px; + width:19px; + height:19px; + background:url(../images/box.png) no-repeat 0 0; + font-size:0; + line-height:0; +} + + /* Bottom corners and border */ +.bb { + height:19px; + margin:0 0 0 19px; + background:url(../images/box.png) no-repeat 100% 100%; +} +.bb div { + position:relative; + left:-19px; + width:19px; + height:19px; + background:url(../images/box.png) no-repeat 0 100%; + font-size:0; + line-height:0; +} + + /* Left border */ +.i1 { + padding:0 0 0 11px; + background:url(../images/borders.png) repeat-y 0 0; +} + /* Right border */ +.i2 { + padding:0 11px 0 0; + background:url(../images/borders.png) repeat-y 100% 0; +} + /* Wrapper for the content. Use it to set the background colour and insert some padding between the borders and the content. */ +.i3 { + display:block; + margin:0; + padding:1px 10px; + background:#fff; +} + /* Make the content wrapper auto clearing so it will contain floats (see http://positioniseverything.net/easyclearing.html). */ +.i3:after { + content:"."; + display:block; + height:0; + clear:both; + visibility:hidden; +} +.i3 {display:inline-block;} +.i3 {display:block;} +/* Default CSS ends here */ + +/* @end */ + +/* @group yacos_button */ + +.yacos_button { + display: inline-block; + background-image: url(../images/button_background_idle.png); + max-height: 40px; + min-width: 50px; + padding:10px; +} + +.yacos_button:hover { + background-image: url(../images/button_background_hover.png); +} + /* @end */ \ No newline at end of file diff --git a/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java b/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java index e341ada..dff9d1a 100644 --- a/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java +++ b/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java @@ -54,19 +54,6 @@ public class SArticleController extends SimpleFormController { String nomFile=""; - Article newArticle = articleManager.addArticle( - title, theme, nomFile, user.getLogin(), - listSecondaryAuthor, Article.State.SUBMITED, conf.getId()); - - if(newArticle==null){ - errors.reject("article.errors.didNotSave"); - try { - return showForm(request, response, errors); - } catch (Exception e) { - e.printStackTrace(); - } - } - try { MultipartFile file = ((FormSubmission) command).getFile(); if (file == null || file.isEmpty()) { @@ -78,7 +65,21 @@ public class SArticleController extends SimpleFormController { } } else { - + + // Creates the article + Article newArticle = articleManager.addArticle( + title, theme, nomFile, user.getLogin(), + listSecondaryAuthor, Article.State.SUBMITED, conf.getId()); + + if(newArticle==null){ + errors.reject("article.errors.didNotSave"); + try { + return showForm(request, response, errors); + } catch (Exception e) { + e.printStackTrace(); + } + } + byte b[] = file.getBytes(); String path = "conference"+conf.getId()+"/"; diff --git a/YACOSWeb/src/org/yacos/web/system/controller/ForgotPasswordController.java b/YACOSWeb/src/org/yacos/web/system/controller/ForgotPasswordController.java new file mode 100644 index 0000000..b8ab02a --- /dev/null +++ b/YACOSWeb/src/org/yacos/web/system/controller/ForgotPasswordController.java @@ -0,0 +1,68 @@ +package org.yacos.web.system.controller; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.springframework.validation.BindException; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.SimpleFormController; +import org.yacos.core.users.IUserManager; +import org.yacos.core.users.User; +import org.yacos.web.system.form.FormForgotPassword; +import org.yacos.web.system.session.YACOSUtils; + +public class ForgotPasswordController extends SimpleFormController { + private IUserManager userManager; + + @Override + protected ModelAndView onSubmit(HttpServletRequest request, + HttpServletResponse response, Object command, BindException errors) + throws Exception { + String email = ((FormForgotPassword) command).getEmail(); + + email = email.toLowerCase(); + Pattern emailPattern = Pattern.compile("^[a-z0-9._-]+@[a-z0-9._-]{2,}[.][a-z]{2,4}$"); // Regex + Matcher emailMatcher = emailPattern.matcher(email); + + User user = null; + if(!emailMatcher.matches()){ + errors.rejectValue("email", "form.forgotPassword.error.emailInvalid"); + } else { + + user = userManager.getUserByEmail(email); + if(user == null){ + errors.rejectValue("email", "form.forgotPassword.error.unknownEmail"); + } + } + + if(errors.hasErrors()){ + return showForm(request,response, errors); + } else { + String newPassword = YACOSUtils.generate(12); + user.setPassword(User.hashPassword(newPassword)); + + System.out.println(newPassword); + + userManager.UpdateUser(user); + + String mailSubject = "Your new YACOS password"; + String mailBody = "You received this email because you requested your account informations.\n"; + mailBody += "A new password has been generated, you can now login using the following informations and change it in your profile view.\n"; + mailBody += "User login : "+user.getLogin()+"\n"; + mailBody += "User password : "+newPassword; + + MailSenderService.getInstance().sendEMail(email, mailSubject, mailBody); + + return new ModelAndView(getSuccessView()); + } + } + + public void setUserManager(IUserManager userManager) { + this.userManager = userManager; + } + + public IUserManager getUserManager() { + return userManager; + } +} diff --git a/YACOSWeb/src/org/yacos/web/system/controller/SUserRegistrationController.java b/YACOSWeb/src/org/yacos/web/system/controller/SUserRegistrationController.java index 7bfc166..20ffc28 100644 --- a/YACOSWeb/src/org/yacos/web/system/controller/SUserRegistrationController.java +++ b/YACOSWeb/src/org/yacos/web/system/controller/SUserRegistrationController.java @@ -5,7 +5,6 @@ package org.yacos.web.system.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - import org.springframework.validation.BindException; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.SimpleFormController; @@ -85,7 +84,7 @@ public class SUserRegistrationController extends SimpleFormController { // We try to see if the user is already registered and logged User currentUser = new User(); user.setIsNew(true); - // TODO : see how JAAS could change the way of getting the current User + if(SessionService.getInstance().isUserLogged()){ // If he is logged, we use his profile information to fill the form currentUser = (User) SessionService.getInstance().getCurrentUser(); diff --git a/YACOSWeb/src/org/yacos/web/system/form/FormForgotPassword.java b/YACOSWeb/src/org/yacos/web/system/form/FormForgotPassword.java new file mode 100644 index 0000000..9905aaf --- /dev/null +++ b/YACOSWeb/src/org/yacos/web/system/form/FormForgotPassword.java @@ -0,0 +1,13 @@ +package org.yacos.web.system.form; + +public class FormForgotPassword { + private String email; + + public void setEmail(String email) { + this.email = email; + } + + public String getEmail() { + return email; + } +} diff --git a/YACOSWeb/src/org/yacos/web/system/session/YACOSUtils.java b/YACOSWeb/src/org/yacos/web/system/session/YACOSUtils.java new file mode 100644 index 0000000..cf2d8a5 --- /dev/null +++ b/YACOSWeb/src/org/yacos/web/system/session/YACOSUtils.java @@ -0,0 +1,15 @@ +package org.yacos.web.system.session; + +public class YACOSUtils { + private static String VALID_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!?%$()"; + + public static String generate(Integer length){ + String password = new String(); + + for(int i=0;i