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
This commit is contained in:
@@ -19,11 +19,12 @@ login.label.login=Login
|
|||||||
login.label.password=Password
|
login.label.password=Password
|
||||||
login.label.rememberme=Remember me
|
login.label.rememberme=Remember me
|
||||||
login.label.register=Register
|
login.label.register=Register
|
||||||
login.label.alreadyaccount:I have already an account
|
login.label.alreadyaccount:I already have an account
|
||||||
# New user
|
# New user
|
||||||
login.label.createnewuser=Create an account
|
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.createaccount="When creating an account on Yacos.com, you may post an article and follow the conference."
|
||||||
login.label.continue=Continue
|
login.label.continue=Continue
|
||||||
|
login.label.forgotPasswordHeading=Forgot your password ?
|
||||||
login.message.error=Your login attempt was not successful, try again.
|
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.
|
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
|
||||||
message.error.noconferenceforthisid=This conference doesn't exist. Pease try again
|
message.error.noconferenceforthisid=This conference doesn't exist. Pease try again
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
<link rel="icon" type="image/png" href="./images/favicon.png" />
|
<link rel="icon" type="image/png" href="./images/favicon.png" />
|
||||||
<title><fmt:message key="title" /></title>
|
<title><fmt:message key="title" /></title>
|
||||||
<link rel="stylesheet" href="./stylesheets/base.css" type="text/css" />
|
<link rel="stylesheet" href="./stylesheets/base.css" type="text/css" />
|
||||||
|
<script type='text/javascript' src='./javascripts/rounded_boxes.js'></script>
|
||||||
<decorator:head />
|
<decorator:head />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
28
YACOSWeb/WebContent/WEB-INF/jsp/forgotPassword.jsp
Normal file
28
YACOSWeb/WebContent/WEB-INF/jsp/forgotPassword.jsp
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<%@ include file="/WEB-INF/decorators/include.jsp"%>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h4 class="title"><fmt:message key="forgotPassword.title" /></h4>
|
||||||
|
<p class="formHelp">
|
||||||
|
<fmt:message key="form.forgotPassword.help"/>
|
||||||
|
</p>
|
||||||
|
<div class="cbb">
|
||||||
|
<form:form commandName="forgotPassword">
|
||||||
|
<h2>
|
||||||
|
<form:label path="email">
|
||||||
|
<fmt:message key="form.forgotPassword.email"/>
|
||||||
|
</form:label>
|
||||||
|
</h2>
|
||||||
|
<form:input path="email"/>
|
||||||
|
<div class="formError">
|
||||||
|
<form:errors path="email"/>
|
||||||
|
</div>
|
||||||
|
<input type="submit" name="submit" value="<fmt:message key="form.forgotPassword.submit"/>"/>
|
||||||
|
</form:form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -5,22 +5,23 @@
|
|||||||
<body>
|
<body>
|
||||||
<h4 class="title">NO NAME</h4>
|
<h4 class="title">NO NAME</h4>
|
||||||
<c:forEach items="${listArticle}" var="article">
|
<c:forEach items="${listArticle}" var="article">
|
||||||
<ul class="article">
|
<div class="article cbb">
|
||||||
<li class="title"><b>${article.title}</b></li>
|
<h2>${article.title}</h2>
|
||||||
<li class="author">Author: <b>${article.mainAuthor.firstName} ${article.mainAuthor.lastName}</b></li>
|
<p class="author">Author: <b>${article.mainAuthor.firstName} ${article.mainAuthor.lastName}</b></p>
|
||||||
<li class="secondaryAuthors">Secondary Authors:
|
<p class="secondaryAuthors">
|
||||||
|
Secondary Authors:
|
||||||
<ul>
|
<ul>
|
||||||
<c:forEach items="${article.secondaryAuthors}" var="sAuthor">
|
<c:forEach items="${article.secondaryAuthors}" var="sAuthor">
|
||||||
<li>${sAuthor}</li>
|
<li>${sAuthor}</li>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
<p class="topic">Topic: <b>${article.topic}</b></p>
|
||||||
<li class="topic">Topic: <b>${article.topic}</b></li>
|
<p class="article_url"><a href="
|
||||||
<li class="article_url"><a href="
|
<c:url value="/download.htm">
|
||||||
<c:url value="/download.htm">
|
<c:param name="articleId" value="${article.id}"/>
|
||||||
<c:param name="articleId" value="${article.id}"/>
|
</c:url>">Download the article</a>
|
||||||
</c:url>">Download the article</a></li>
|
</p>
|
||||||
</ul>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<hr />
|
<hr />
|
||||||
<br />
|
<br />
|
||||||
|
|||||||
@@ -32,7 +32,8 @@
|
|||||||
</c:when>
|
</c:when>
|
||||||
<c:otherwise>
|
<c:otherwise>
|
||||||
<c:forEach items="${listConference}" var="conference">
|
<c:forEach items="${listConference}" var="conference">
|
||||||
<div class="conferenceBloc">
|
<div class="conferenceBloc cbb">
|
||||||
|
<h2>${conference.title}</h2>
|
||||||
ID : ${conference.id}<br />
|
ID : ${conference.id}<br />
|
||||||
Title : ${conference.title}<br />
|
Title : ${conference.title}<br />
|
||||||
Description : ${conference.description}<br />
|
Description : ${conference.description}<br />
|
||||||
|
|||||||
@@ -15,11 +15,14 @@
|
|||||||
|
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr><td width="50%">
|
<tr><td width="50%">
|
||||||
<fmt:message key="login.label.createnewuser" /><br />
|
<div class="cbb">
|
||||||
|
<h2><fmt:message key="login.label.createnewuser" /></h2>
|
||||||
<fmt:message key="login.label.createaccount" /><br />
|
<fmt:message key="login.label.createaccount" /><br />
|
||||||
<a href="registerUser.htm"><fmt:message key="login.label.continue" /></a>
|
<a href="registerUser.htm"><fmt:message key="login.label.register" /></a>
|
||||||
|
</div>
|
||||||
</td><td>
|
</td><td>
|
||||||
<fmt:message key="login.label.alreadyaccount" /> :<br />
|
<div class="cbb">
|
||||||
|
<h2><fmt:message key="login.label.alreadyaccount" /> :</h2>
|
||||||
<form action="<c:url value='j_acegi_security_check'/>" method="POST" id="formlogin">
|
<form action="<c:url value='j_acegi_security_check'/>" method="POST" id="formlogin">
|
||||||
<fmt:message key="login.label.login" /> : <input type='text' name='j_username' /><br />
|
<fmt:message key="login.label.login" /> : <input type='text' name='j_username' /><br />
|
||||||
<fmt:message key="login.label.password" /> : <input type='password' name='j_password' /><br />
|
<fmt:message key="login.label.password" /> : <input type='password' name='j_password' /><br />
|
||||||
@@ -28,7 +31,12 @@
|
|||||||
<br /><br />
|
<br /><br />
|
||||||
<a href="javascript:document.getElementById('formlogin').submit();" id="submit_btn"><fmt:message key="login.btn.connexion" /></a>
|
<a href="javascript:document.getElementById('formlogin').submit();" id="submit_btn"><fmt:message key="login.btn.connexion" /></a>
|
||||||
</form>
|
</form>
|
||||||
|
<div class="yacos_button">
|
||||||
|
<a href="<c:url value="/forgotPassword.htm"/>">
|
||||||
|
<fmt:message key="login.label.forgotPasswordHeading"/>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -76,7 +76,9 @@
|
|||||||
<prop key="/listReport.htm">
|
<prop key="/listReport.htm">
|
||||||
ListReportController
|
ListReportController
|
||||||
</prop>
|
</prop>
|
||||||
|
<prop key="/forgotPassword.htm">
|
||||||
|
ForgotPasswordController
|
||||||
|
</prop>
|
||||||
</props>
|
</props>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
@@ -119,6 +121,17 @@
|
|||||||
class="org.yacos.web.system.validation.UserValidator">
|
class="org.yacos.web.system.validation.UserValidator">
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="ForgotPasswordController"
|
||||||
|
class="org.yacos.web.system.controller.ForgotPasswordController">
|
||||||
|
<property name="sessionForm" value="false" />
|
||||||
|
<property name="commandName" value="forgotPassword" />
|
||||||
|
<property name="commandClass"
|
||||||
|
value="org.yacos.web.system.form.FormForgotPassword" />
|
||||||
|
<property name="formView" value="forgotPassword" />
|
||||||
|
<property name="successView" value="forgotPassword.htm" />
|
||||||
|
<property name="userManager" ref="userManager" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
<bean id="SArticleController"
|
<bean id="SArticleController"
|
||||||
class="org.yacos.web.author.controller.SArticleController">
|
class="org.yacos.web.author.controller.SArticleController">
|
||||||
<property name="sessionForm" value="true" />
|
<property name="sessionForm" value="true" />
|
||||||
|
|||||||
BIN
YACOSWeb/WebContent/images/borders.png
Normal file
BIN
YACOSWeb/WebContent/images/borders.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 136 B |
BIN
YACOSWeb/WebContent/images/box.png
Normal file
BIN
YACOSWeb/WebContent/images/box.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
BIN
YACOSWeb/WebContent/images/button_background_clic.png
Normal file
BIN
YACOSWeb/WebContent/images/button_background_clic.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 646 B |
BIN
YACOSWeb/WebContent/images/button_background_hover.png
Normal file
BIN
YACOSWeb/WebContent/images/button_background_hover.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 135 B |
BIN
YACOSWeb/WebContent/images/button_background_idle.png
Normal file
BIN
YACOSWeb/WebContent/images/button_background_idle.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 148 B |
BIN
YACOSWeb/WebContent/images/error_bullet.png
Normal file
BIN
YACOSWeb/WebContent/images/error_bullet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
74
YACOSWeb/WebContent/javascripts/rounded_boxes.js
Normal file
74
YACOSWeb/WebContent/javascripts/rounded_boxes.js
Normal file
@@ -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<arrElements.length; i++) {
|
||||||
|
// Save the original outer element for later
|
||||||
|
oElement = arrElements[i];
|
||||||
|
if (oRegExp.test(oElement.className)) {
|
||||||
|
// Create a new element and give it the original element's class name(s) while replacing 'cbb' with 'cb'
|
||||||
|
oOuter = document.createElement('div');
|
||||||
|
oOuter.className = oElement.className.replace(oRegExp, '$1cb$2');
|
||||||
|
// Give the new div the original element's id if it has one
|
||||||
|
if (oElement.getAttribute("id")) {
|
||||||
|
tempId = oElement.id;
|
||||||
|
oElement.removeAttribute('id');
|
||||||
|
oOuter.setAttribute('id', '');
|
||||||
|
oOuter.id = tempId;
|
||||||
|
}
|
||||||
|
// Change the original element's class name and replace it with the new div
|
||||||
|
oElement.className = 'i3';
|
||||||
|
oElement.parentNode.replaceChild(oOuter, oElement);
|
||||||
|
// Create two new div elements and insert them into the outermost div
|
||||||
|
oI1 = document.createElement('div');
|
||||||
|
oI1.className = 'i1';
|
||||||
|
oOuter.appendChild(oI1);
|
||||||
|
oI2 = document.createElement('div');
|
||||||
|
oI2.className = 'i2';
|
||||||
|
oI1.appendChild(oI2);
|
||||||
|
// Insert the original element
|
||||||
|
oI2.appendChild(oElement);
|
||||||
|
// Insert the top and bottom divs
|
||||||
|
cbb.insertTop(oOuter);
|
||||||
|
cbb.insertBottom(oOuter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
insertTop : function(obj) {
|
||||||
|
var oOuter, oInner;
|
||||||
|
// Create the two div elements needed for the top of the box
|
||||||
|
oOuter=document.createElement("div");
|
||||||
|
oOuter.className="bt"; // The outer div needs a class name
|
||||||
|
oInner=document.createElement("div");
|
||||||
|
oOuter.appendChild(oInner);
|
||||||
|
obj.insertBefore(oOuter,obj.firstChild);
|
||||||
|
},
|
||||||
|
insertBottom : function(obj) {
|
||||||
|
var oOuter, oInner;
|
||||||
|
// Create the two div elements needed for the bottom of the box
|
||||||
|
oOuter=document.createElement("div");
|
||||||
|
oOuter.className="bb"; // The outer div needs a class name
|
||||||
|
oInner=document.createElement("div");
|
||||||
|
oOuter.appendChild(oInner);
|
||||||
|
obj.appendChild(oOuter);
|
||||||
|
},
|
||||||
|
// addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
|
||||||
|
addEvent : function(obj, type, fn) {
|
||||||
|
if (obj.addEventListener)
|
||||||
|
obj.addEventListener(type, fn, false);
|
||||||
|
else if (obj.attachEvent) {
|
||||||
|
obj["e"+type+fn] = fn;
|
||||||
|
obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
|
||||||
|
obj.attachEvent("on"+type, obj[type+fn]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
cbb.addEvent(window, 'load', cbb.init);
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
/* @override http://localhost:8080/YACOSWeb/stylesheets/base.css */
|
||||||
|
|
||||||
/* @group RESET */
|
/* @group RESET */
|
||||||
|
|
||||||
html,body,div,ul,ol,li,dl,dt,dd,h1,h2,h3,h4,h5,h6,pre,form,p,blockquote,fieldset,input { margin: 0; padding: 0; }
|
html,body,div,ul,ol,li,dl,dt,dd,h1,h2,h3,h4,h5,h6,pre,form,p,blockquote,fieldset,input { margin: 0; padding: 0; }
|
||||||
@@ -26,9 +28,24 @@ body {
|
|||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.formHelp {
|
||||||
|
padding: 5px;
|
||||||
|
border: thin solid #94ff90;
|
||||||
|
background-color: #dfffe4;
|
||||||
|
}
|
||||||
|
|
||||||
.formError{
|
.formError{
|
||||||
color: #ff0000;
|
color: #ff0000;
|
||||||
font-size: 10px;
|
}
|
||||||
|
|
||||||
|
.formError > * {
|
||||||
|
display: list-item;
|
||||||
|
list-style-position: inside;
|
||||||
|
list-style-image: url(../images/error_bullet.png);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @group Login */
|
/* @group Login */
|
||||||
@@ -138,7 +155,6 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#maincontent {
|
#maincontent {
|
||||||
position: relative;
|
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,13 +228,17 @@ body {
|
|||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#maincontent > * {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
#main #maincontent h4.title {
|
#main #maincontent h4.title {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
height: 23px;
|
height: 23px;
|
||||||
position: relative;
|
|
||||||
top: 2px;
|
top: 2px;
|
||||||
margin-bottom: 6px;
|
margin-bottom: 6px;
|
||||||
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @end */
|
/* @end */
|
||||||
@@ -298,4 +318,109 @@ body {
|
|||||||
.selected {
|
.selected {
|
||||||
background-color: #fea752;
|
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 */
|
/* @end */
|
||||||
@@ -54,19 +54,6 @@ public class SArticleController extends SimpleFormController {
|
|||||||
|
|
||||||
String nomFile="";
|
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 {
|
try {
|
||||||
MultipartFile file = ((FormSubmission) command).getFile();
|
MultipartFile file = ((FormSubmission) command).getFile();
|
||||||
if (file == null || file.isEmpty()) {
|
if (file == null || file.isEmpty()) {
|
||||||
@@ -79,6 +66,20 @@ public class SArticleController extends SimpleFormController {
|
|||||||
}
|
}
|
||||||
else {
|
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();
|
byte b[] = file.getBytes();
|
||||||
|
|
||||||
String path = "conference"+conf.getId()+"/";
|
String path = "conference"+conf.getId()+"/";
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,6 @@ package org.yacos.web.system.controller;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.springframework.validation.BindException;
|
import org.springframework.validation.BindException;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
import org.springframework.web.servlet.mvc.SimpleFormController;
|
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
|
// We try to see if the user is already registered and logged
|
||||||
User currentUser = new User();
|
User currentUser = new User();
|
||||||
user.setIsNew(true);
|
user.setIsNew(true);
|
||||||
// TODO : see how JAAS could change the way of getting the current User
|
|
||||||
if(SessionService.getInstance().isUserLogged()){
|
if(SessionService.getInstance().isUserLogged()){
|
||||||
// If he is logged, we use his profile information to fill the form
|
// If he is logged, we use his profile information to fill the form
|
||||||
currentUser = (User) SessionService.getInstance().getCurrentUser();
|
currentUser = (User) SessionService.getInstance().getCurrentUser();
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
15
YACOSWeb/src/org/yacos/web/system/session/YACOSUtils.java
Normal file
15
YACOSWeb/src/org/yacos/web/system/session/YACOSUtils.java
Normal file
@@ -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<length;i++){
|
||||||
|
password += VALID_CHARS.charAt((int)(Math.random()*((double)VALID_CHARS.length())));
|
||||||
|
}
|
||||||
|
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user