Ajout du service d'envoi d'email
Mise en place des invitations dans creer conf Mise en place de proprietés de config pour Servlet-config.xml Ajout des listes dynamiques dans le CSS
This commit is contained in:
@@ -1 +1,3 @@
|
|||||||
download.dir.path=../server/default/data/uploadedFiles/
|
download.dir.path=../server/default/data/uploadedFiles/
|
||||||
|
mailService.fromEmailAddress=system@yacos.dreamhosters.com
|
||||||
|
mailService.replyToEmailAddress=no-reply@yacos.dreamhosters.com
|
||||||
@@ -97,7 +97,7 @@ form.submission.listauthor=Article's author
|
|||||||
form.submission.mainauthor=Main author
|
form.submission.mainauthor=Main author
|
||||||
form.submission.secondaryauthor=Secondary authors
|
form.submission.secondaryauthor=Secondary authors
|
||||||
form.submission.file=File
|
form.submission.file=File
|
||||||
|
form.addConference.invitationsHeader=Invitations
|
||||||
|
|
||||||
|
|
||||||
button.add=Add
|
button.add=Add
|
||||||
@@ -162,7 +162,7 @@ submissionArticle.file=please choose an article to submit
|
|||||||
|
|
||||||
#valider les articles
|
#valider les articles
|
||||||
validate.download=download the article
|
validate.download=download the article
|
||||||
validate.report=consulter the result of the evaluation
|
validate.report=View the result of the evaluation
|
||||||
validate.validate=validate
|
validate.validate=validate
|
||||||
validate.reject=reject
|
validate.reject=reject
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
<script type='text/javascript' src='./dwr/util.js'></script>
|
<script type='text/javascript' src='./dwr/util.js'></script>
|
||||||
<script type='text/javascript' src='./dwr/interface/AddCriteriaJS.js'></script>
|
<script type='text/javascript' src='./dwr/interface/AddCriteriaJS.js'></script>
|
||||||
<script type='text/javascript' src='./javascripts/prototype.js'></script>
|
<script type='text/javascript' src='./javascripts/prototype.js'></script>
|
||||||
|
<script type='text/javascript' src='./javascripts/yacos/addConference_invitation.js'></script>
|
||||||
|
<script type='text/javascript' src='./javascripts/scriptaculous.js'></script>
|
||||||
|
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
|
|
||||||
@@ -81,15 +83,6 @@ function addPerson(eleid) {
|
|||||||
dwr.engine.endBatch();
|
dwr.engine.endBatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
function addInvitation() {
|
|
||||||
var email = $("emailAddress").value;
|
|
||||||
dwr.engine.beginBatch();
|
|
||||||
AddCriteriaJS.addInvitation(email);
|
|
||||||
fillTable();
|
|
||||||
fillTable2();
|
|
||||||
dwr.engine.endBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
function deletePerson(eleid) {
|
function deletePerson(eleid) {
|
||||||
var person = peopleCache2[eleid.substring(11)];
|
var person = peopleCache2[eleid.substring(11)];
|
||||||
if (confirm("Are you sure you want to delete " + person.firstName + " " + person.lastName + "?")) {
|
if (confirm("Are you sure you want to delete " + person.firstName + " " + person.lastName + "?")) {
|
||||||
@@ -153,11 +146,6 @@ function filterUser(el, value) {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<br />
|
|
||||||
<fmt:message key="invitation.send"/> <br/>
|
|
||||||
Mail: <input id="emailAddress" type="text"/> <a id="invitationEmail" href="#" onclick="addInvitation()" >Invite</a>
|
|
||||||
|
|
||||||
<br />
|
|
||||||
<br />
|
<br />
|
||||||
<table border="1" id="tableNameAdded" style="display: none;">
|
<table border="1" id="tableNameAdded" style="display: none;">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -176,6 +164,17 @@ function filterUser(el, value) {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<fmt:message key="invitation.send"/> <br/>
|
||||||
|
Mail: <input id="emailAddress" type="text"/> <input type="button" name="inviteButton" id="inviteButton" value="Invite"/>
|
||||||
|
|
||||||
|
<div id="invitationList" class="dynamicList">
|
||||||
|
<div class="dynamicListHeader">
|
||||||
|
<fmt:message key="form.addConference.invitationsHeader" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input type="button" id="removeInvitationButton" name="removeInvitation" value="<fmt:message key="button.removeSelected" />"/>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<input type="submit" align="middle" name="_target3" value="Back">
|
<input type="submit" align="middle" name="_target3" value="Back">
|
||||||
|
|||||||
@@ -6,11 +6,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h4 class="title"><fmt:message key="preference.title" /></h4>
|
<h4 class="title"><fmt:message key="preference.title" /></h4>
|
||||||
|
|
||||||
<c:if test="${message}">
|
<c:if test="${message}">
|
||||||
<fmt:message key="message"/>
|
<fmt:message key="message"/>
|
||||||
huhu
|
|
||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<form:form method="post" commandName="choosePreference">
|
<form:form method="post" commandName="choosePreference">
|
||||||
@@ -23,11 +22,11 @@ huhu
|
|||||||
<form:hidden path="preferences[${i.index}].article.id" />
|
<form:hidden path="preferences[${i.index}].article.id" />
|
||||||
<form:hidden path="preferences[${i.index}].pcMember.login" />
|
<form:hidden path="preferences[${i.index}].pcMember.login" />
|
||||||
<td><fmt:message key="preference.like"/></td>
|
<td><fmt:message key="preference.like"/></td>
|
||||||
<td><form:radiobutton path="preferences[${i.index}].preference" value="Like"/></td>
|
<td><form:radiobutton path="preferences[${i.index}].preferenceType" value="LIKE"/></td>
|
||||||
<td><fmt:message key="preference.indifferent"/></td>
|
<td><fmt:message key="preference.indifferent"/></td>
|
||||||
<td><form:radiobutton path="preferences[${i.index}].preference" value="Indifferent"/></td>
|
<td><form:radiobutton path="preferences[${i.index}].preferenceType" value="INDIFFERENT"/></td>
|
||||||
<td><fmt:message key="preference.dislike"/></td>
|
<td><fmt:message key="preference.dislike"/></td>
|
||||||
<td><form:radiobutton path="preferences[${i.index}].preference" value="Dislike"/></td>
|
<td><form:radiobutton path="preferences[${i.index}].preferenceType" value="DISLIKE"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -5,78 +5,7 @@
|
|||||||
<script type='text/javascript' src='./javascripts/prototype.js'></script>
|
<script type='text/javascript' src='./javascripts/prototype.js'></script>
|
||||||
<script type='text/javascript' src='./javascripts/scriptaculous.js'></script>
|
<script type='text/javascript' src='./javascripts/scriptaculous.js'></script>
|
||||||
<script type='text/javascript' src='./javascripts/effects.js'></script>
|
<script type='text/javascript' src='./javascripts/effects.js'></script>
|
||||||
<style type="text/css">
|
<script type='text/javascript' src='./javascripts/yacos/submissionArticle.js'></script>
|
||||||
.dynamicList {
|
|
||||||
display: table;
|
|
||||||
border-collapse: collapse;
|
|
||||||
min-width: 200px;
|
|
||||||
max-height: 200px;
|
|
||||||
overflow: scroll;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dynamicList > * {
|
|
||||||
display: table-row;
|
|
||||||
border: thin solid #f57627;
|
|
||||||
padding:3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dynamicListHeader {
|
|
||||||
background-color: #f57627;
|
|
||||||
}
|
|
||||||
|
|
||||||
.selected {
|
|
||||||
background-color: #fea752;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script language="JavaScript">
|
|
||||||
|
|
||||||
var SecondaryAuthorManager = Class.create({
|
|
||||||
lastRef: 0,
|
|
||||||
initialize: function(buttonAdd,buttonRemove,inputField){
|
|
||||||
this.buttonAdd = buttonAdd;
|
|
||||||
this.buttonRemove = buttonRemove;
|
|
||||||
this.inputField = inputField;
|
|
||||||
$(buttonAdd).observe("click",this.AddSecondaryAuthor.bind(this));
|
|
||||||
$(buttonRemove).observe("click",this.RemoveSecondaryAuthor.bind(this));
|
|
||||||
$(inputField).observe("keypress", this.KeyPressHandler.bindAsEventListener(this));
|
|
||||||
},
|
|
||||||
SelectSecondaryAuthor: function(event){
|
|
||||||
var item = event.element();
|
|
||||||
if(item.hasClassName('selected')){
|
|
||||||
item.removeClassName('selected');
|
|
||||||
} else {
|
|
||||||
item.addClassName('selected');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
RemoveSecondaryAuthor: function() {
|
|
||||||
var itemsToRemove = $('secondaryAuthorList').select('div.selected');
|
|
||||||
itemsToRemove.invoke('remove');
|
|
||||||
},
|
|
||||||
KeyPressHandler: function(event){
|
|
||||||
switch(event.keyCode){
|
|
||||||
case Event.KEY_RETURN:
|
|
||||||
this.AddSecondaryAuthor();
|
|
||||||
event.stop();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
AddSecondaryAuthor: function() {
|
|
||||||
var ref = this.lastRef++;
|
|
||||||
var elemName = "liste["+ref+"]";
|
|
||||||
var value = $('newSecondaryAuthorInput').value;
|
|
||||||
var hidden = new Element('input',{'id':elemName,'name':elemName,'type':'hidden','value':value});
|
|
||||||
var elem = new Element('div',
|
|
||||||
{ 'class':'dynamicListItem',
|
|
||||||
'style':'display:none;height:0px;width:0px;',
|
|
||||||
'id':elemName}).update(value).insert(hidden);
|
|
||||||
elem.observe('click', this.SelectSecondaryAuthor.bindAsEventListener());
|
|
||||||
$('secondaryAuthorList').insert(elem);
|
|
||||||
$(this.inputField).clear();
|
|
||||||
Effect.Appear(elemName);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@@ -108,11 +37,7 @@ var SecondaryAuthorManager = Class.create({
|
|||||||
<fmt:message key="form.submission.secondaryauthor" />
|
<fmt:message key="form.submission.secondaryauthor" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input type="button" id="removeSecondaryButton" name="removeSecondary" value="<fmt:message key="button.removeSelected" />"/>
|
<input type="button" id="removeSecondaryButton" name="removeSecondary" value="<fmt:message key="button.removeSelected" />"/>
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
new SecondaryAuthorManager('addSecondaryButton','removeSecondaryButton','newSecondaryAuthorInput');
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<br /><br />
|
<br /><br />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|||||||
@@ -202,7 +202,7 @@
|
|||||||
class="org.yacos.web.PCmember.controller.CreateReportController">
|
class="org.yacos.web.PCmember.controller.CreateReportController">
|
||||||
<property name="articleManager" ref="articleManager" />
|
<property name="articleManager" ref="articleManager" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="LogonController"
|
<bean id="LogonController"
|
||||||
class="org.yacos.web.system.controller.LogonController">
|
class="org.yacos.web.system.controller.LogonController">
|
||||||
</bean>
|
</bean>
|
||||||
@@ -212,6 +212,7 @@
|
|||||||
class="org.yacos.web.system.controller.ListConferenceController">
|
class="org.yacos.web.system.controller.ListConferenceController">
|
||||||
<property name="conferenceManager" ref="conferenceManager" />
|
<property name="conferenceManager" ref="conferenceManager" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
<bean id="ListEvaluationController"
|
<bean id="ListEvaluationController"
|
||||||
class="org.yacos.web.PCmember.controller.ListEvaluationController">
|
class="org.yacos.web.PCmember.controller.ListEvaluationController">
|
||||||
@@ -285,6 +286,17 @@
|
|||||||
class="org.yacos.web.system.session.SessionService">
|
class="org.yacos.web.system.session.SessionService">
|
||||||
<property name="conferenceManager" ref="conferenceManager" />
|
<property name="conferenceManager" ref="conferenceManager" />
|
||||||
<property name="userManager" ref="userManager" />
|
<property name="userManager" ref="userManager" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
|
||||||
|
<property name="host" value="smtp.univ-lille1.fr"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="mailSenderService"
|
||||||
|
class="org.yacos.web.system.controller.MailSenderService" factory-method="getInstance">
|
||||||
|
<property name="mailSender" ref="mailSender"/>
|
||||||
|
<property name="fromEmail" value="${mailService.fromEmailAddress}" />
|
||||||
|
<property name="replyTo" value="${mailService.replyToEmailAddress}" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- EJB Services Linking -->
|
<!-- EJB Services Linking -->
|
||||||
|
|||||||
BIN
YACOSWeb/WebContent/images/menu-header-background-repeat.png
Normal file
BIN
YACOSWeb/WebContent/images/menu-header-background-repeat.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 141 B |
@@ -0,0 +1,66 @@
|
|||||||
|
|
||||||
|
var InvitationsManager = Class.create({
|
||||||
|
initialize: function(buttonAdd,buttonRemove,inputField){
|
||||||
|
this.buttonAdd = buttonAdd;
|
||||||
|
this.buttonRemove = buttonRemove;
|
||||||
|
this.inputField = inputField;
|
||||||
|
$(buttonAdd).observe("click",this.addRemote.bind(this));
|
||||||
|
$(buttonRemove).observe("click",this.removeRemote.bind(this));
|
||||||
|
$(inputField).observe("keypress", this.keyPressHandler.bindAsEventListener(this));
|
||||||
|
},
|
||||||
|
select: function(event){
|
||||||
|
var item = event.element();
|
||||||
|
if(item.hasClassName('selected')){
|
||||||
|
item.removeClassName('selected');
|
||||||
|
} else {
|
||||||
|
item.addClassName('selected');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
removeRemote: function() {
|
||||||
|
var itemsToRemove = $('invitationList').select('div.selected');
|
||||||
|
var emailList = itemsToRemove.pluck('id');
|
||||||
|
AddCriteriaJS.removeInvitations(emailList,this.remove.bind(this));
|
||||||
|
},
|
||||||
|
remove: function() {
|
||||||
|
var itemsToRemove = $('invitationList').select('div.selected');
|
||||||
|
itemsToRemove.invoke('remove');
|
||||||
|
},
|
||||||
|
keyPressHandler: function(event){
|
||||||
|
switch(event.keyCode){
|
||||||
|
case Event.KEY_RETURN:
|
||||||
|
this.addRemote();
|
||||||
|
event.stop();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addRemote: function(){
|
||||||
|
var value = $(this.inputField).value;
|
||||||
|
AddCriteriaJS.addInvitation(value,function(success){
|
||||||
|
if(success){
|
||||||
|
this.add(value);
|
||||||
|
}
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
add: function(email) {
|
||||||
|
var elem = new Element('div',
|
||||||
|
{ 'class':'dynamicListItem',
|
||||||
|
'style':'display:none;height:0px;width:0px;',
|
||||||
|
'id':email}).update(email);
|
||||||
|
$('invitationList').insert(elem);
|
||||||
|
elem.observe('click', this.select.bindAsEventListener());
|
||||||
|
elem.appear();
|
||||||
|
},
|
||||||
|
refreshList: function(){
|
||||||
|
AddCriteriaJS.getInvitations(function(emailList){
|
||||||
|
this.removeAll();
|
||||||
|
emailList.each(this.add.bind(this));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
removeAll: function(){
|
||||||
|
var itemsToRemove = $('invitationList').select('div.dynamicListItem');
|
||||||
|
itemsToRemove.invoke('remove');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Event.observe(window,'load', function(){
|
||||||
|
new InvitationsManager('inviteButton','removeInvitationButton','emailAddress')});
|
||||||
54
YACOSWeb/WebContent/javascripts/yacos/submissionArticle.js
Normal file
54
YACOSWeb/WebContent/javascripts/yacos/submissionArticle.js
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
|
||||||
|
var SecondaryAuthorManager = Class.create({
|
||||||
|
lastRef: 0,
|
||||||
|
initialize: function(buttonAdd,buttonRemove,inputField){
|
||||||
|
this.buttonAdd = buttonAdd;
|
||||||
|
this.buttonRemove = buttonRemove;
|
||||||
|
this.inputField = inputField;
|
||||||
|
$(buttonAdd).observe("click",this.AddSecondaryAuthor.bind(this));
|
||||||
|
$(buttonRemove).observe("click",this.RemoveSecondaryAuthor.bind(this));
|
||||||
|
$(inputField).observe("keypress", this.KeyPressHandler.bindAsEventListener(this));
|
||||||
|
},
|
||||||
|
SelectSecondaryAuthor: function(event){
|
||||||
|
var item = event.element();
|
||||||
|
if(item.hasClassName('selected')){
|
||||||
|
item.removeClassName('selected');
|
||||||
|
} else {
|
||||||
|
item.addClassName('selected');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
RemoveSecondaryAuthor: function() {
|
||||||
|
var itemsToRemove = $('secondaryAuthorList').select('div.selected');
|
||||||
|
// Fade and remove
|
||||||
|
itemsToRemove.invoke('fade',{
|
||||||
|
afterFinish: function(obj){
|
||||||
|
obj.element.remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
KeyPressHandler: function(event){
|
||||||
|
switch(event.keyCode){
|
||||||
|
case Event.KEY_RETURN:
|
||||||
|
this.AddSecondaryAuthor();
|
||||||
|
event.stop();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
AddSecondaryAuthor: function() {
|
||||||
|
var ref = this.lastRef++;
|
||||||
|
var elemName = "liste["+ref+"]";
|
||||||
|
var value = $('newSecondaryAuthorInput').value;
|
||||||
|
var hidden = new Element('input',{'id':elemName,'name':elemName,'type':'hidden','value':value});
|
||||||
|
var elem = new Element('div',
|
||||||
|
{ 'class':'dynamicListItem',
|
||||||
|
'style':'display:none;height:0px;width:0px;',
|
||||||
|
'id':elemName}).update(value).insert(hidden);
|
||||||
|
elem.observe('click', this.SelectSecondaryAuthor.bindAsEventListener());
|
||||||
|
$('secondaryAuthorList').insert(elem);
|
||||||
|
$(this.inputField).clear();
|
||||||
|
elem.appear();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Event.observe(window,'load', function(){
|
||||||
|
new SecondaryAuthorManager('addSecondaryButton','removeSecondaryButton','newSecondaryAuthorInput')});
|
||||||
@@ -251,3 +251,31 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* @end */
|
/* @end */
|
||||||
|
|
||||||
|
/* @group dynamicList */
|
||||||
|
.dynamicList {
|
||||||
|
display: table;
|
||||||
|
border-collapse: collapse;
|
||||||
|
border-spacing: 3px;
|
||||||
|
min-width: 200px;
|
||||||
|
min-height: 40px;
|
||||||
|
max-height: 200px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dynamicList > * {
|
||||||
|
display: table-row;
|
||||||
|
border: thin solid #f57627;
|
||||||
|
padding:3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dynamicListHeader {
|
||||||
|
background-image: url(../images/menu-header-background-repeat.png);
|
||||||
|
background-repeat: repeat-x;
|
||||||
|
height: 23px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.selected {
|
||||||
|
background-color: #fea752;
|
||||||
|
}
|
||||||
|
/* @end */
|
||||||
@@ -6,12 +6,18 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.acegisecurity.util.UrlUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.mail.MailSendException;
|
||||||
import org.springframework.validation.BindException;
|
import org.springframework.validation.BindException;
|
||||||
import org.springframework.validation.Errors;
|
import org.springframework.validation.Errors;
|
||||||
|
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
import org.springframework.web.servlet.ModelAndViewDefiningException;
|
import org.springframework.web.servlet.ModelAndViewDefiningException;
|
||||||
import org.springframework.web.servlet.mvc.AbstractWizardFormController;
|
import org.springframework.web.servlet.mvc.AbstractWizardFormController;
|
||||||
@@ -19,13 +25,17 @@ import org.yacos.core.conferences.Conference;
|
|||||||
import org.yacos.core.conferences.IConferenceManager;
|
import org.yacos.core.conferences.IConferenceManager;
|
||||||
import org.yacos.core.evaluation.Criterion;
|
import org.yacos.core.evaluation.Criterion;
|
||||||
import org.yacos.core.evaluation.IEvaluationManager;
|
import org.yacos.core.evaluation.IEvaluationManager;
|
||||||
|
import org.yacos.core.exceptions.ConferenceDoesntExistException;
|
||||||
import org.yacos.core.users.IUserManager;
|
import org.yacos.core.users.IUserManager;
|
||||||
import org.yacos.core.users.User;
|
import org.yacos.core.users.User;
|
||||||
import org.yacos.core.users.Role.RoleType;
|
import org.yacos.core.users.Role.RoleType;
|
||||||
import org.yacos.web.chairman.form.FormConference;
|
import org.yacos.web.chairman.form.FormConference;
|
||||||
import org.yacos.web.chairman.validation.ConferenceValidator;
|
import org.yacos.web.chairman.validation.ConferenceValidator;
|
||||||
|
import org.yacos.web.system.controller.MailSenderService;
|
||||||
import org.yacos.web.system.session.SessionService;
|
import org.yacos.web.system.session.SessionService;
|
||||||
|
|
||||||
|
import com.sun.mail.smtp.SMTPAddressFailedException;
|
||||||
|
|
||||||
public class AddConferenceController extends AbstractWizardFormController {
|
public class AddConferenceController extends AbstractWizardFormController {
|
||||||
|
|
||||||
protected final Log logger = LogFactory.getLog(getClass());
|
protected final Log logger = LogFactory.getLog(getClass());
|
||||||
@@ -33,7 +43,7 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
private IConferenceManager conferenceManager;
|
private IConferenceManager conferenceManager;
|
||||||
|
|
||||||
private IUserManager userManager;
|
private IUserManager userManager;
|
||||||
|
|
||||||
private IEvaluationManager evaluationManager;
|
private IEvaluationManager evaluationManager;
|
||||||
|
|
||||||
public IEvaluationManager getEvaluationManager() {
|
public IEvaluationManager getEvaluationManager() {
|
||||||
@@ -62,6 +72,7 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
private List<PersonBean> listPersonBean;
|
private List<PersonBean> listPersonBean;
|
||||||
private List<PersonBean> listPersonFiltered;
|
private List<PersonBean> listPersonFiltered;
|
||||||
private List<PersonBean> listPersonAdded;
|
private List<PersonBean> listPersonAdded;
|
||||||
|
private List<String> listInvitations;
|
||||||
|
|
||||||
public void fillUser(String text) {
|
public void fillUser(String text) {
|
||||||
if (text.equals(""))
|
if (text.equals(""))
|
||||||
@@ -89,12 +100,6 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
listPersonFiltered.remove(truePerson);
|
listPersonFiltered.remove(truePerson);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addInvitation(String email){
|
|
||||||
PersonBean invitationBean = new PersonBean();
|
|
||||||
invitationBean.setLogin(email);
|
|
||||||
listPersonAdded.add(invitationBean);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deletePerson(PersonBean b) {
|
public void deletePerson(PersonBean b) {
|
||||||
|
|
||||||
PersonBean truePerson = getTruePerson(b.getLogin());
|
PersonBean truePerson = getTruePerson(b.getLogin());
|
||||||
@@ -136,6 +141,30 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
public List<PersonBean> getUsersAdded() {
|
public List<PersonBean> getUsersAdded() {
|
||||||
return listPersonAdded;
|
return listPersonAdded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getInvitation(){
|
||||||
|
return listInvitations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean addInvitation(String email){
|
||||||
|
email = email.toLowerCase();
|
||||||
|
Pattern emailPattern = Pattern.compile("^[a-z0-9._-]+@[a-z0-9._-]{2,}[.][a-z]{2,4}$"); // Regex
|
||||||
|
Matcher emailMatcher = emailPattern.matcher(email);
|
||||||
|
|
||||||
|
if(!emailMatcher.matches()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
listInvitations.add(email);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeInvitations(List<String> emailList){
|
||||||
|
for(String email : emailList){
|
||||||
|
listInvitations.remove(email);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ###########################################################
|
// ###########################################################
|
||||||
@@ -145,7 +174,7 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
|
|
||||||
private Set<CriterionBean> criteria;
|
private Set<CriterionBean> criteria;
|
||||||
private Set<CriterionBean> criteriaAll;
|
private Set<CriterionBean> criteriaAll;
|
||||||
|
|
||||||
public Set<CriterionBean> getCriteriaAll() {
|
public Set<CriterionBean> getCriteriaAll() {
|
||||||
return criteriaAll;
|
return criteriaAll;
|
||||||
}
|
}
|
||||||
@@ -153,7 +182,7 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
public Set<CriterionBean> getCriteriaAdded() {
|
public Set<CriterionBean> getCriteriaAdded() {
|
||||||
return criteria;
|
return criteria;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CriterionBean getTrueCriteria(int id) {
|
public CriterionBean getTrueCriteria(int id) {
|
||||||
for (CriterionBean cb : criteriaAll) {
|
for (CriterionBean cb : criteriaAll) {
|
||||||
if (cb.getId() == id){
|
if (cb.getId() == id){
|
||||||
@@ -166,15 +195,15 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
return cb;
|
return cb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCriterionClick(CriterionBean c) {
|
public void setCriterionClick(CriterionBean c) {
|
||||||
if (c.getId() == -1) {
|
if (c.getId() == -1) {
|
||||||
c.setId(getNextId());
|
c.setId(getNextId());
|
||||||
}
|
}
|
||||||
|
|
||||||
criteria.remove(c);
|
criteria.remove(c);
|
||||||
criteria.add(c);
|
criteria.add(c);
|
||||||
}
|
}
|
||||||
@@ -185,18 +214,18 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CriterionBean trueCriteria = getTrueCriteria(c.getId());
|
CriterionBean trueCriteria = getTrueCriteria(c.getId());
|
||||||
|
|
||||||
criteria.remove(trueCriteria);
|
criteria.remove(trueCriteria);
|
||||||
criteria.add(trueCriteria);
|
criteria.add(trueCriteria);
|
||||||
criteriaAll.remove(trueCriteria);
|
criteriaAll.remove(trueCriteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteCriterion(CriterionBean c) {
|
public void deleteCriterion(CriterionBean c) {
|
||||||
|
|
||||||
CriterionBean trueCriteria = getTrueCriteria(c.getId());
|
CriterionBean trueCriteria = getTrueCriteria(c.getId());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
criteria.remove(trueCriteria);
|
criteria.remove(trueCriteria);
|
||||||
criteriaAll.add(trueCriteria);
|
criteriaAll.add(trueCriteria);
|
||||||
}
|
}
|
||||||
@@ -216,14 +245,15 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
|
|
||||||
protected Object formBackingObject(HttpServletRequest request) throws ModelAndViewDefiningException {
|
protected Object formBackingObject(HttpServletRequest request) throws ModelAndViewDefiningException {
|
||||||
logger.info(this.getClass().toString() + " dans le formBackingObject");
|
logger.info(this.getClass().toString() + " dans le formBackingObject");
|
||||||
|
|
||||||
FormConference conference = new FormConference();
|
FormConference conference = new FormConference();
|
||||||
|
|
||||||
String action = request.getParameter("action");
|
String action = request.getParameter("action");
|
||||||
if (action == null || action.equals("")) {
|
if (action == null || action.equals(""))
|
||||||
// TODO : tester ici si le gars a le droit d'<27>tre ici
|
{
|
||||||
// a-t-il le droit de cr<63>er une conf<6E>rence ?
|
// TODO : tester ici si le gars a le droit d'<27>tre ici
|
||||||
|
// a-t-il le droit de cr<63>er une conf<6E>rence ?
|
||||||
|
|
||||||
criteria = new HashSet<CriterionBean>();
|
criteria = new HashSet<CriterionBean>();
|
||||||
criteriaAll = new HashSet<CriterionBean>();
|
criteriaAll = new HashSet<CriterionBean>();
|
||||||
List<Criterion> listCriterion = evaluationManager.getCriterions();
|
List<Criterion> listCriterion = evaluationManager.getCriterions();
|
||||||
@@ -246,9 +276,10 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
criteriaAll.add(cb);
|
criteriaAll.add(cb);
|
||||||
getNextId();
|
getNextId();
|
||||||
}
|
}
|
||||||
|
|
||||||
listPersonBean = new ArrayList<PersonBean>();
|
listPersonBean = new ArrayList<PersonBean>();
|
||||||
listPersonAdded = new ArrayList<PersonBean>();
|
listPersonAdded = new ArrayList<PersonBean>();
|
||||||
|
listInvitations = new ArrayList<String>();
|
||||||
listPersonFiltered = listPersonBean;
|
listPersonFiltered = listPersonBean;
|
||||||
List<User> listUsers = userManager.getUsers();
|
List<User> listUsers = userManager.getUsers();
|
||||||
for (User user : listUsers) {
|
for (User user : listUsers) {
|
||||||
@@ -259,12 +290,12 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
pb.setLogin(user.getLogin());
|
pb.setLogin(user.getLogin());
|
||||||
listPersonBean.add(pb);
|
listPersonBean.add(pb);
|
||||||
}
|
}
|
||||||
|
|
||||||
return conference;
|
return conference;
|
||||||
}
|
}
|
||||||
else if (action.equals("modify")) {
|
else if (action.equals("modify")) {
|
||||||
Conference conf = SessionService.getInstance().getCurrentConference();
|
Conference conf = SessionService.getInstance().getCurrentConference();
|
||||||
|
|
||||||
criteria = new HashSet<CriterionBean>();
|
criteria = new HashSet<CriterionBean>();
|
||||||
criteriaAll = new HashSet<CriterionBean>();
|
criteriaAll = new HashSet<CriterionBean>();
|
||||||
|
|
||||||
@@ -309,6 +340,8 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
|
|
||||||
listPersonBean = new ArrayList<PersonBean>();
|
listPersonBean = new ArrayList<PersonBean>();
|
||||||
listPersonAdded = new ArrayList<PersonBean>();
|
listPersonAdded = new ArrayList<PersonBean>();
|
||||||
|
// Should get the invitation tokens and allow them to be removed
|
||||||
|
listInvitations = new ArrayList<String>();
|
||||||
listPersonFiltered = listPersonBean;
|
listPersonFiltered = listPersonBean;
|
||||||
List<User> listUsers = userManager.getUsers();
|
List<User> listUsers = userManager.getUsers();
|
||||||
for (User user : listUsers) {
|
for (User user : listUsers) {
|
||||||
@@ -338,7 +371,7 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
listPersonBean.remove(person);
|
listPersonBean.remove(person);
|
||||||
|
|
||||||
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
|
||||||
conference.setTitle(conf.getTitle());
|
conference.setTitle(conf.getTitle());
|
||||||
conference.setDateArticleParsed(conf.getDateArticle());
|
conference.setDateArticleParsed(conf.getDateArticle());
|
||||||
conference.setDateArticle(format.format(conf.getDateArticle()));
|
conference.setDateArticle(format.format(conf.getDateArticle()));
|
||||||
@@ -350,7 +383,7 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
conference.setDateStart(format.format(conf.getDateStart()));
|
conference.setDateStart(format.format(conf.getDateStart()));
|
||||||
conference.setDescription(conf.getDescription());
|
conference.setDescription(conf.getDescription());
|
||||||
conference.setOtherInformations(conf.getOtherInformations());
|
conference.setOtherInformations(conf.getOtherInformations());
|
||||||
|
|
||||||
// TODO : ajouter ca ds conf ejb...
|
// TODO : ajouter ca ds conf ejb...
|
||||||
/*conference.setPageNumber(pageNumber);
|
/*conference.setPageNumber(pageNumber);
|
||||||
conference.setSendInfo(sendInfo);
|
conference.setSendInfo(sendInfo);
|
||||||
@@ -358,18 +391,18 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
conference.setTypeODT(typeODT);
|
conference.setTypeODT(typeODT);
|
||||||
conference.setTypePDF(typePDF);
|
conference.setTypePDF(typePDF);
|
||||||
conference.setTypeWord(typeWord);*/
|
conference.setTypeWord(typeWord);*/
|
||||||
|
|
||||||
return conference;
|
return conference;
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void validatePage(Object command, Errors errors, int page) {
|
protected void validatePage(Object command, Errors errors, int page) {
|
||||||
FormConference conference = (FormConference) command;
|
FormConference conference = (FormConference) command;
|
||||||
ConferenceValidator conferenceValidator = (ConferenceValidator) getValidator();
|
ConferenceValidator conferenceValidator = (ConferenceValidator) getValidator();
|
||||||
@@ -393,36 +426,60 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
String action = request.getParameter("action");
|
String action = request.getParameter("action");
|
||||||
if (action == null || action.equals("")) {
|
if (action == null || action.equals("")) {
|
||||||
|
|
||||||
Conference conf = conferenceManager.addConference(
|
|
||||||
conference.getTitle(),
|
Conference conf = conferenceManager.addConference(
|
||||||
conference.getDescription(),
|
conference.getTitle(),
|
||||||
conference.getOtherInformations(),
|
conference.getDescription(),
|
||||||
conference.getDateArticleParsed(),
|
conference.getOtherInformations(),
|
||||||
conference.getDateArticleParsed(),
|
conference.getDateArticleParsed(),
|
||||||
conference.getDateEvaluationParsed(),
|
conference.getDateArticleParsed(),
|
||||||
conference.getDateStartParsed(),
|
conference.getDateEvaluationParsed(),
|
||||||
conference.getDateEndParsed());
|
conference.getDateStartParsed(),
|
||||||
|
conference.getDateEndParsed());
|
||||||
conference.setConferenceId(conf.getId());
|
|
||||||
SessionService.getInstance().setCurrentConference(conf);
|
conference.setConferenceId(conf.getId());
|
||||||
|
SessionService.getInstance().setCurrentConference(conf);
|
||||||
for(CriterionBean criterion : criteria){
|
|
||||||
conferenceManager.addCriterionToConference(
|
for(CriterionBean criterion : criteria){
|
||||||
conf.getId(),
|
conferenceManager.addCriterionToConference(
|
||||||
criterion.getLabel(),
|
conf.getId(),
|
||||||
criterion.getMin(),
|
criterion.getLabel(),
|
||||||
criterion.getMax());
|
criterion.getMin(),
|
||||||
}
|
criterion.getMax());
|
||||||
|
|
||||||
for(PersonBean personBean : listPersonAdded){
|
|
||||||
conferenceManager.addPCMemberToConference(
|
|
||||||
conf.getId(),
|
|
||||||
personBean.getLogin());
|
|
||||||
}
|
|
||||||
|
|
||||||
conferenceManager.addRole(RoleType.CHAIRMAN, SessionService.getInstance().getCurrentUserLogin(), conf.getId());
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
for(PersonBean personBean : listPersonAdded){
|
||||||
|
conferenceManager.addPCMemberToConference(
|
||||||
|
conf.getId(),
|
||||||
|
personBean.getLogin());
|
||||||
|
}
|
||||||
|
|
||||||
|
String mailSubject = "YACOS "+conf.getTitle()+" invitation";
|
||||||
|
String mailBody = "Greetings,\n";
|
||||||
|
mailBody += "You've been invited to join the program comity of the conference :\n";
|
||||||
|
mailBody += conf.getTitle()+"/n";
|
||||||
|
mailBody += "You can register on this page : \n";
|
||||||
|
String baseUrl = request.getSession().getServletContext().getContextPath();
|
||||||
|
mailBody += baseUrl+"/registerUser.htm /n";
|
||||||
|
mailBody += "Please note that you MUST use this eMail address in the registration form in order to get the appropriate credentials.";
|
||||||
|
// TODO : use a template
|
||||||
|
for(String invitationEmail : listInvitations){
|
||||||
|
try {
|
||||||
|
conferenceManager.addInvitationToken(invitationEmail, RoleType.PCMEMBER, conf.getId());
|
||||||
|
MailSenderService.getInstance().sendEMail(invitationEmail, mailSubject , mailBody);
|
||||||
|
} catch (ConferenceDoesntExistException e) {
|
||||||
|
// Should never happen
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (MailSendException e) {
|
||||||
|
// TODO : see what we can do about this
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
conferenceManager.addRole(RoleType.CHAIRMAN, SessionService.getInstance().getCurrentUserLogin(), conf.getId());
|
||||||
|
// Refresh the roles to take into account the chairman credentials
|
||||||
|
SessionService.getInstance().refreshAuthentication();
|
||||||
|
} else {
|
||||||
Conference conf = SessionService.getInstance().getCurrentConference();
|
Conference conf = SessionService.getInstance().getCurrentConference();
|
||||||
conf.setTitle(conference.getTitle());
|
conf.setTitle(conference.getTitle());
|
||||||
conf.setDescription(conference.getDescription());
|
conf.setDescription(conference.getDescription());
|
||||||
@@ -452,7 +509,6 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
conf.getId(),
|
conf.getId(),
|
||||||
personBean.getLogin());
|
personBean.getLogin());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ModelAndView("main");
|
return new ModelAndView("main");
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package org.yacos.web.system.controller;
|
||||||
|
|
||||||
|
import org.springframework.mail.MailSender;
|
||||||
|
import org.springframework.mail.SimpleMailMessage;
|
||||||
|
|
||||||
|
public class MailSenderService {
|
||||||
|
public static MailSenderService instance = new MailSenderService();
|
||||||
|
private MailSender mailSender;
|
||||||
|
private String fromEmail;
|
||||||
|
private String replyTo;
|
||||||
|
|
||||||
|
public MailSenderService(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MailSenderService getInstance(){
|
||||||
|
if(instance == null){
|
||||||
|
instance = new MailSenderService();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendEMail(String toEmail, String subject, String body){
|
||||||
|
SimpleMailMessage message = composeEmail(toEmail, fromEmail, subject, body, replyTo, null, null);
|
||||||
|
mailSender.send(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SimpleMailMessage composeEmail(String toEmail, String fromEmail, String subject, String body){
|
||||||
|
return composeEmail(toEmail, fromEmail, subject, body, fromEmail, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SimpleMailMessage composeEmail(String toEmail, String fromEmail, String subject, String body, String replyTo, String cc, String bcc){
|
||||||
|
SimpleMailMessage mailMessage = new SimpleMailMessage();
|
||||||
|
|
||||||
|
mailMessage.setTo(toEmail);
|
||||||
|
mailMessage.setFrom(fromEmail);
|
||||||
|
mailMessage.setSubject(subject);
|
||||||
|
mailMessage.setText(body);
|
||||||
|
mailMessage.setReplyTo(replyTo);
|
||||||
|
if(cc!=null){
|
||||||
|
mailMessage.setCc(cc);
|
||||||
|
}
|
||||||
|
if(bcc != null){
|
||||||
|
mailMessage.setBcc(bcc);
|
||||||
|
}
|
||||||
|
|
||||||
|
return mailMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFromEmail() {
|
||||||
|
return fromEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFromEmail(String fromEmail) {
|
||||||
|
this.fromEmail = fromEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReplyTo() {
|
||||||
|
return replyTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReplyTo(String replyTo) {
|
||||||
|
this.replyTo = replyTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMailSender(MailSender mailSender) {
|
||||||
|
this.mailSender = mailSender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MailSender getMailSender() {
|
||||||
|
return mailSender;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -74,6 +74,15 @@ public class SessionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IConferenceManager getConferenceManager() {
|
public IConferenceManager getConferenceManager() {
|
||||||
|
if(conferenceManager == null){
|
||||||
|
Context context;
|
||||||
|
try {
|
||||||
|
context = new InitialContext();
|
||||||
|
conferenceManager = (IConferenceManager) context.lookup("ConferenceManagerBean/remote");
|
||||||
|
} catch (NamingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
return conferenceManager;
|
return conferenceManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,6 +91,15 @@ public class SessionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IUserManager getUserManager() {
|
public IUserManager getUserManager() {
|
||||||
|
if(userManager == null){
|
||||||
|
Context context;
|
||||||
|
try {
|
||||||
|
context = new InitialContext();
|
||||||
|
userManager = (IUserManager) context.lookup("UserManagerBean/remote");
|
||||||
|
} catch (NamingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
return userManager;
|
return userManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public class UserValidator implements Validator {
|
|||||||
|
|
||||||
// EMAIL VALIDATOR
|
// EMAIL VALIDATOR
|
||||||
public void validateEmail(String email, Errors errors){
|
public void validateEmail(String email, Errors errors){
|
||||||
|
email = email.toLowerCase();
|
||||||
Pattern emailPattern = Pattern.compile("^[a-z0-9._-]+@[a-z0-9._-]{2,}[.][a-z]{2,4}$"); // Regex
|
Pattern emailPattern = Pattern.compile("^[a-z0-9._-]+@[a-z0-9._-]{2,}[.][a-z]{2,4}$"); // Regex
|
||||||
Matcher emailMatcher = emailPattern.matcher(email);
|
Matcher emailMatcher = emailPattern.matcher(email);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user