r32 - in trunk: . vradi-services/src/main/java/org/chorem/vradi/services/managers vradi-services/src/main/java/org/chorem/vradi/services/tasks vradi-swing/src/main/java/org/chorem/vradi vradi-swing/src/main/java/org/chorem/vradi/services vradi-web vradi-web/src/main/java/org/chorem/vradi vradi-web/src/main/java/org/chorem/vradi/actions vradi-web/src/main/java/org/chorem/vradi/interceptors vradi-web/src/main/resources vradi-web/src/main/resources/i18n vradi-web/src/main/webapp vradi-web/src/m
Author: sletellier Date: 2011-05-20 16:08:45 +0200 (Fri, 20 May 2011) New Revision: 32 Url: http://chorem.org/repositories/revision/vradi/32 Log: #376 Cr?\195?\169ation de l'authentification Added: trunk/vradi-web/src/main/java/org/chorem/vradi/actions/ trunk/vradi-web/src/main/java/org/chorem/vradi/actions/ForgotPasswordAction.java trunk/vradi-web/src/main/java/org/chorem/vradi/actions/HomeAction.java trunk/vradi-web/src/main/java/org/chorem/vradi/actions/LoginAction.java trunk/vradi-web/src/main/java/org/chorem/vradi/actions/LogoutAction.java trunk/vradi-web/src/main/java/org/chorem/vradi/actions/RegisterAction.java trunk/vradi-web/src/main/java/org/chorem/vradi/actions/VradiBaseAction.java trunk/vradi-web/src/main/java/org/chorem/vradi/interceptors/ trunk/vradi-web/src/main/java/org/chorem/vradi/interceptors/LoginInterceptor.java trunk/vradi-web/src/main/java/org/chorem/vradi/interceptors/LogoutInterceptor.java trunk/vradi-web/src/main/resources/struts.properties trunk/vradi-web/src/main/webapp/index.html trunk/vradi-web/src/main/webapp/jsp/ trunk/vradi-web/src/main/webapp/jsp/forgotPassword.jsp trunk/vradi-web/src/main/webapp/jsp/home.jsp trunk/vradi-web/src/main/webapp/jsp/login.jsp trunk/vradi-web/src/main/webapp/jsp/register.jsp Removed: trunk/vradi-web/src/main/webapp/index.jsp Modified: trunk/pom.xml trunk/vradi-services/src/main/java/org/chorem/vradi/services/managers/MailingManager.java trunk/vradi-services/src/main/java/org/chorem/vradi/services/tasks/ImportXmlStreamTasks.java trunk/vradi-swing/src/main/java/org/chorem/vradi/VradiConfig.java trunk/vradi-swing/src/main/java/org/chorem/vradi/services/VradiService.java trunk/vradi-web/pom.xml trunk/vradi-web/src/main/java/org/chorem/vradi/VradiSession.java trunk/vradi-web/src/main/java/org/chorem/vradi/VradiWebConfig.java trunk/vradi-web/src/main/resources/i18n/vradi-web_en_GB.properties trunk/vradi-web/src/main/resources/i18n/vradi-web_fr_FR.properties trunk/vradi-web/src/main/resources/struts.xml trunk/vradi-web/src/main/resources/vradi-web.properties trunk/vradi-web/src/main/webapp/WEB-INF/web.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2011-05-18 15:56:32 UTC (rev 31) +++ trunk/pom.xml 2011-05-20 14:08:45 UTC (rev 32) @@ -114,7 +114,7 @@ <nuitonI18nVersion>2.4</nuitonI18nVersion> <nuitonWidgetVersion>1.1.1</nuitonWidgetVersion> <generatorPluginVersion>2.3.3</generatorPluginVersion> - <wikittyVersion>3.1.2</wikittyVersion> + <wikittyVersion>3.1.3-SNAPSHOT</wikittyVersion> <oooVersion>3.2.1</oooVersion> <javamailVersion>1.4.3</javamailVersion> <slf4jVersion>1.6.1</slf4jVersion> Modified: trunk/vradi-services/src/main/java/org/chorem/vradi/services/managers/MailingManager.java =================================================================== --- trunk/vradi-services/src/main/java/org/chorem/vradi/services/managers/MailingManager.java 2011-05-18 15:56:32 UTC (rev 31) +++ trunk/vradi-services/src/main/java/org/chorem/vradi/services/managers/MailingManager.java 2011-05-20 14:08:45 UTC (rev 32) @@ -149,53 +149,8 @@ } return null; } - String result; - // TODO EC-20100505 use Session.getDefaultInstance() - // and common Properties form receiving/sending mails ! - Properties props = new Properties(); - props.put("mail.smtp.host", VradiServiceConfigurationHelper.getSmtpHost(config)); - props.put("mail.smtp.port", VradiServiceConfigurationHelper.getSmtpPort(config)); - //props.put("mail.smtp.auth", "true"); - //props.put("mail.smtp.socketFactory.port", config.getSmtpPort()); - //props.put("mail.smtp.socketFactory.class", SSL_FACTORY); - //props.put("mail.smtp.socketFactory.fallback", "false"); - //props.put("mail.debug", config.isMailDebug()); - - Session session = Session.getInstance(props, - new Authenticator() { - @Override - protected PasswordAuthentication getPasswordAuthentication() { - return new PasswordAuthentication( - VradiServiceConfigurationHelper.getMailUser(config), - VradiServiceConfigurationHelper.getMailPassword(config)); - } - }); - - // EC-20100427 : attention, ca affiche le contenu des pdf joint - // c'est absolument illisible - //session.setDebug(log.isDebugEnabled()); - - // create a message - MimeMessage msg = new MimeMessage(session); - try { - // set the from and to address - InternetAddress addressFrom = new InternetAddress( - VradiServiceConfigurationHelper.getMailFrom(config), - VradiServiceConfigurationHelper.getMailFromName(config)); - - msg.setFrom(addressFrom); - - InternetAddress addressTo = new InternetAddress(recipient); - msg.addRecipient(Message.RecipientType.TO, addressTo); - - if (receptionProof) { - // Optional : You can also set your custom headers in the Email if you Want - msg.addHeader("Return-Receipt-To", VradiServiceConfigurationHelper.getMailFrom(config)); - msg.addHeader("Disposition-Notification-To", VradiServiceConfigurationHelper.getMailFrom(config)); - } - Multipart multiparts = new MimeMultipart(); // create the message part @@ -263,6 +218,106 @@ } } + return postMail(config, recipient, subject, receptionProof, multiparts); + } catch (MessagingException eee) { + if (log.isErrorEnabled()) { + log.error("Can't generate message", eee); + } + throw new VradiException(_("vradi.error.sending.send", eee.getMessage())); + } + } + + /** + * Sends an email to the specified recipient with the specified subject + * and the specified message and the specified forms PDF. + * + * @param recipient the email address of the recipient + * @param subject mail subject + * @param receptionProof if true, ask for a reception proof + * @param msg content of mail + * @return the message id of the email sent + * @throws VradiException + */ + public static String postMail(ApplicationConfig config, String recipient, String subject, + boolean receptionProof, + String msg) throws MessagingException, VradiException { + + Multipart multiparts = new MimeMultipart(); + + // create the message part + MimeBodyPart msgBodyPart = new MimeBodyPart(); + msgBodyPart.setText(msg); + multiparts.addBodyPart(msgBodyPart); + + return postMail(config, recipient, subject, receptionProof, multiparts); + } + + /** + * Sends an email to the specified recipient with the specified subject + * and the specified message and the specified forms PDF. + * + * @param recipient the email address of the recipient + * @param subject mail subject + * @param receptionProof if true, ask for a reception proof + * @param multiparts content of mail + * @return the message id of the email sent + * @throws VradiException + */ + public static String postMail(ApplicationConfig config, String recipient, String subject, + boolean receptionProof, + Multipart multiparts) throws VradiException { + + if (StringUtils.isBlank(recipient)) { + if (log.isWarnEnabled()) { + log.warn(_("Nothing to send : %s", recipient)); + } + return null; + } + String result; + + // TODO EC-20100505 use Session.getDefaultInstance() + // and common Properties form receiving/sending mails ! + Properties props = new Properties(); + props.put("mail.smtp.host", VradiServiceConfigurationHelper.getSmtpHost(config)); + props.put("mail.smtp.port", VradiServiceConfigurationHelper.getSmtpPort(config)); + //props.put("mail.smtp.auth", "true"); + //props.put("mail.smtp.socketFactory.port", config.getSmtpPort()); + //props.put("mail.smtp.socketFactory.class", SSL_FACTORY); + //props.put("mail.smtp.socketFactory.fallback", "false"); + //props.put("mail.debug", config.isMailDebug()); + + final String mailUser = VradiServiceConfigurationHelper.getMailUser(config); + final String mailPassword = VradiServiceConfigurationHelper.getMailPassword(config); + Session session = Session.getInstance(props, + new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication( + mailUser, + mailPassword); + } + }); + + // create a message + MimeMessage msg = new MimeMessage(session); + + try { + // set the from and to address + InternetAddress addressFrom = new InternetAddress( + VradiServiceConfigurationHelper.getMailFrom(config), + VradiServiceConfigurationHelper.getMailFromName(config)); + + msg.setFrom(addressFrom); + + InternetAddress addressTo = new InternetAddress(recipient); + msg.addRecipient(Message.RecipientType.TO, addressTo); + + if (receptionProof) { + // Optional : You can also set your custom headers in the Email if you Want + msg.addHeader("Return-Receipt-To", VradiServiceConfigurationHelper.getMailFrom(config)); + msg.addHeader("Disposition-Notification-To", VradiServiceConfigurationHelper.getMailFrom(config)); + } + // Put parts in message msg.setContent(multiparts); @@ -303,7 +358,6 @@ } return result; } - /** * Receives the emails and check if some are error emails or reception proofs * and treat them in consequence. Modified: trunk/vradi-services/src/main/java/org/chorem/vradi/services/tasks/ImportXmlStreamTasks.java =================================================================== --- trunk/vradi-services/src/main/java/org/chorem/vradi/services/tasks/ImportXmlStreamTasks.java 2011-05-18 15:56:32 UTC (rev 31) +++ trunk/vradi-services/src/main/java/org/chorem/vradi/services/tasks/ImportXmlStreamTasks.java 2011-05-20 14:08:45 UTC (rev 32) @@ -32,25 +32,14 @@ import org.chorem.vradi.entities.XmlStream; import org.chorem.vradi.services.VradiException; import org.chorem.vradi.services.managers.BindingManager; +import org.chorem.vradi.services.managers.MailingManager; import org.nuiton.util.ApplicationConfig; import org.nuiton.util.ExceptionUtil; import org.nuiton.util.TimeLog; import org.nuiton.wikitty.WikittyProxy; -import javax.mail.Authenticator; -import javax.mail.Message; import javax.mail.MessagingException; -import javax.mail.Multipart; -import javax.mail.PasswordAuthentication; -import javax.mail.Session; -import javax.mail.Transport; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeBodyPart; -import javax.mail.internet.MimeMessage; -import javax.mail.internet.MimeMultipart; -import java.io.UnsupportedEncodingException; import java.util.List; -import java.util.Properties; import java.util.TimerTask; import static org.nuiton.i18n.I18n._; @@ -139,74 +128,19 @@ } return; } + String msg = _("vradi.error.errorImportXmlStream", xmlStream.getName(), + ExceptionUtil.stackTrace(error)); - // TODO EC-20100505 use Session.getDefaultInstance() - // and common Properties form receiving/sending mails ! - Properties props = new Properties(); - props.put("mail.smtp.host", VradiServiceConfigurationHelper.getSmtpHost(config)); - props.put("mail.smtp.port", VradiServiceConfigurationHelper.getSmtpPort(config)); - //props.put("mail.smtp.auth", "true"); - //props.put("mail.smtp.socketFactory.port", config.getSmtpPort()); - //props.put("mail.smtp.socketFactory.class", SSL_FACTORY); - //props.put("mail.smtp.socketFactory.fallback", "false"); - //props.put("mail.debug", config.isMailDebug()); + // Setting the Subject and Content Type + String subject = _("vradi.error.errorImportXmlStream.subject", xmlStream.getName()); - Session session = Session.getInstance(props, - new Authenticator() { - @Override - protected PasswordAuthentication getPasswordAuthentication() { - return new PasswordAuthentication( - VradiServiceConfigurationHelper.getMailUser(config), - VradiServiceConfigurationHelper.getMailPassword(config)); - } - }); - - // EC-20100427 : attention, ca affiche le contenu des pdf joint - // c'est absolument illisible - //session.setDebug(log.isDebugEnabled()); - - // create a message - MimeMessage msg = new MimeMessage(session); - try { - // set the from and to address - InternetAddress addressFrom = new InternetAddress(VradiServiceConfigurationHelper.getMailFrom(config), - VradiServiceConfigurationHelper.getMailFromName(config)); - - msg.setFrom(addressFrom); - - InternetAddress addressTo = new InternetAddress(email); - msg.addRecipient(Message.RecipientType.TO, addressTo); - - Multipart multiparts = new MimeMultipart(); - - // create the message part - MimeBodyPart msgBodyPart = new MimeBodyPart(); - msgBodyPart.setText(_("vradi.error.errorImportXmlStream", xmlStream.getName(), - ExceptionUtil.stackTrace(error))); - - multiparts.addBodyPart(msgBodyPart); - - // Put parts in message - msg.setContent(multiparts); - - // Setting the Subject and Content Type - msg.setSubject(_("vradi.error.errorImportXmlStream.subject", xmlStream.getName())); - - try { - Transport.send(msg); - } catch (MessagingException eee) { - if (log.isErrorEnabled()) { - log.error("Cant send mail", eee); - } - } - - + MailingManager.postMail(config, email, subject, false, msg); } catch (MessagingException eee) { if (log.isErrorEnabled()) { log.error("Can't generate message", eee); } - } catch (UnsupportedEncodingException eee) { + } catch (VradiException eee) { if (log.isErrorEnabled()) { log.error("Can't generate message", eee); } Modified: trunk/vradi-swing/src/main/java/org/chorem/vradi/VradiConfig.java =================================================================== --- trunk/vradi-swing/src/main/java/org/chorem/vradi/VradiConfig.java 2011-05-18 15:56:32 UTC (rev 31) +++ trunk/vradi-swing/src/main/java/org/chorem/vradi/VradiConfig.java 2011-05-20 14:08:45 UTC (rev 32) @@ -73,12 +73,12 @@ // Creating instance of ApplicationConfig config = new ApplicationConfig(VradiSwingOption.CONFIG_FILE.getDefaultValue()); + // Load wikitty options + config.loadDefaultOptions(WikittyConfigOption.class); + // Load service options config.loadDefaultOptions(VradiServiceConfiguration.VradiServiceOption.class); - // Load wikitty options - config.loadDefaultOptions(WikittyConfigOption.class); - // Load vradi options config.loadDefaultOptions(VradiSwingOption.class); Modified: trunk/vradi-swing/src/main/java/org/chorem/vradi/services/VradiService.java =================================================================== --- trunk/vradi-swing/src/main/java/org/chorem/vradi/services/VradiService.java 2011-05-18 15:56:32 UTC (rev 31) +++ trunk/vradi-swing/src/main/java/org/chorem/vradi/services/VradiService.java 2011-05-20 14:08:45 UTC (rev 32) @@ -28,6 +28,8 @@ import org.apache.commons.logging.LogFactory; import org.chorem.vradi.VradiConfigHelper; import org.nuiton.util.ApplicationConfig; +import org.nuiton.wikitty.WikittyConfig; +import org.nuiton.wikitty.WikittyConfigOption; import org.nuiton.wikitty.WikittyProxy; import org.nuiton.wikitty.WikittyService; import org.nuiton.wikitty.WikittyServiceFactory; Modified: trunk/vradi-web/pom.xml =================================================================== --- trunk/vradi-web/pom.xml 2011-05-18 15:56:32 UTC (rev 31) +++ trunk/vradi-web/pom.xml 2011-05-20 14:08:45 UTC (rev 32) @@ -137,6 +137,12 @@ </dependency> <dependency> + <groupId>org.nuiton.wikitty</groupId> + <artifactId>wikitty-hessian-client</artifactId> + <scope>runtime</scope> + </dependency> + + <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <scope>runtime</scope> @@ -173,6 +179,7 @@ </dependencies> <build> + <resources> <resource> <directory>src/main/resources</directory> @@ -205,13 +212,8 @@ </userRulesFiles> <namespaces> <s>http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd</s> - <sx> - http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd - </sx> + <sx>http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd</sx> <jsp>http://java.sun.com/JSP/Page</jsp> - <decorator> - http://www.opensymphony.com/sitemesh/decorator - </decorator> </namespaces> </configuration> </execution> Modified: trunk/vradi-web/src/main/java/org/chorem/vradi/VradiSession.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/VradiSession.java 2011-05-18 15:56:32 UTC (rev 31) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/VradiSession.java 2011-05-20 14:08:45 UTC (rev 32) @@ -1,15 +1,19 @@ package org.chorem.vradi; +import java.util.Locale; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.vradi.entities.VradiUser; +import org.nuiton.i18n.I18n; +import org.nuiton.i18n.init.DefaultI18nInitializer; import org.nuiton.util.ApplicationConfig; +import org.nuiton.wikitty.WikittyConfigOption; import org.nuiton.wikitty.WikittyProxy; import org.nuiton.wikitty.WikittyService; import org.nuiton.wikitty.WikittyServiceFactory; -import org.nuiton.wikitty.entities.WikittyUser; /** * Classe utilisee pour stocker les objets utils en session utilisateur @@ -28,18 +32,28 @@ static final private String VRADI_SESSION_KEY = VradiSession.class.getSimpleName(); protected WikittyProxy proxy; - private WikittyUser user; + protected ApplicationConfig config; + private VradiUser user; public VradiSession() { - ApplicationConfig config = VradiWebConfig.getConfig(); + config = VradiWebConfig.getConfig(); + + // Init wikitty service WikittyService ws = WikittyServiceFactory.buildWikittyService(config); proxy = new WikittyProxy(config, ws); + + // init I18n +// I18n.init(new DefaultI18nInitializer("vradi-i18n"), null); } - static public void invalidate(Map<String, Object> session) { - session.remove(VRADI_SESSION_KEY); + public void invalidate() { + this.user = null; } + public ApplicationConfig getConfig() { + return config; + } + static public VradiSession getVradiSession(HttpServletRequest request) { HttpSession session = request.getSession(); VradiSession result = getVradiSession(session); @@ -68,7 +82,11 @@ return proxy; } - public WikittyUser getUser() { + public VradiUser getUser() { return user; } + + public void setUser(VradiUser user) { + this.user = user; + } } Modified: trunk/vradi-web/src/main/java/org/chorem/vradi/VradiWebConfig.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/VradiWebConfig.java 2011-05-18 15:56:32 UTC (rev 31) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/VradiWebConfig.java 2011-05-20 14:08:45 UTC (rev 32) @@ -38,12 +38,12 @@ // Creating instance of ApplicationConfig config = new ApplicationConfig(VradiWebOption.CONFIG_FILE.getDefaultValue()); + // Load wikitty options + config.loadDefaultOptions(WikittyConfigOption.class); + // Load service options config.loadDefaultOptions(VradiServiceConfiguration.VradiServiceOption.class); - // Load wikitty options - config.loadDefaultOptions(WikittyConfigOption.class); - // Load vradi options config.loadDefaultOptions(VradiWebOption.class); @@ -80,7 +80,7 @@ CONFIG_FILE( ApplicationConfig.CONFIG_FILE_NAME, _("vradi.config.configFileName.description"), - "vradi.properties", String.class, true, true), + "vradi-web.properties", String.class, true, true), VRADI_VERSION( "vradi.version", @@ -108,7 +108,7 @@ REMOTE_ENDPOINT( "vradi.remote.endpoint", _("vradi.config.remote.endpoint.description"), - "", String.class, false, false); + "http://localhost:8080", String.class, false, false); public String key; Added: trunk/vradi-web/src/main/java/org/chorem/vradi/actions/ForgotPasswordAction.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/actions/ForgotPasswordAction.java (rev 0) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/actions/ForgotPasswordAction.java 2011-05-20 14:08:45 UTC (rev 32) @@ -0,0 +1,105 @@ +package org.chorem.vradi.actions; + +import javax.mail.MessagingException; +import javax.mail.internet.AddressException; + +import org.apache.commons.lang.RandomStringUtils; +import org.chorem.vradi.entities.VradiUser; +import org.chorem.vradi.services.managers.MailingManager; +import org.nuiton.util.StringUtil; +import org.nuiton.wikitty.search.Criteria; +import org.nuiton.wikitty.WikittyProxy; +import org.nuiton.wikitty.search.Search; + +import static org.nuiton.i18n.I18n.n_; + +/** + * Genere un nouveau mot de passe pour l'utilisateur et lui envoie par mail + * TODO poussin 20110211 il faudrait ajouter une securite pour eviter que + * quelqu'un s'amuse a demander la modification de password de quelqu'un d'autre + * toutes les 2s + * - soit en ne permettant l'envoi qu'une fois par jour + * - soit ???? + * + * @author poussin + */ +public class ForgotPasswordAction extends VradiBaseAction { + private static final long serialVersionUID = -8207951465957204954L; + protected String email; + + /** + * @return the email + */ + public String getEmail() { + return email; + } + + /** + * @param email the email to set + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * Generates a new password and sends it to the user + */ + public String execute() { + String result = INPUT; + + try { + if (email != null) { + email = email.trim(); + if (!email.isEmpty()) { + WikittyProxy proxy = getProxy(); + Criteria criteria = Search.query() + .eq(VradiUser.FQ_FIELD_WIKITTYUSER_LOGIN, email).criteria(); + VradiUser user = proxy.findByCriteria(VradiUser.class, criteria); + + if (user != null) { //If the email address exists + String password = ""; + String md5 = ""; + + password = RandomStringUtils.randomAlphanumeric(20); + md5 = StringUtil.encodeMD5(password); + try { + String mailContent; + + mailContent = getText(n_("vradi.register.mailHi")) + + ",\n\n" + getText(n_("vradi.register.mailPwd")) + ": " + + password + "\n\n" + getText(n_("vradi.register.mailEmail")) + + ": " + email + "\n\n"; + MailingManager.postMail(getConfig(), email, + getText(n_("vradi.register.mailSubject")), + false, + mailContent); + + //The password is changed only if the mail has been sent + user.setPassword(md5); + proxy.store(user); + } catch (AddressException e) { + //If the email address is invalid + String message = getText("vradi.mail.badFormat"); + + addActionError(n_(message)); + log.error(message + " (email:" + email + ")", e); + } catch (MessagingException e) { + String message = getText("vradi.mail.sendError"); + + addActionError(n_(message)); + log.error(message + "(" + e.getMessage() + ")", e); + } + result = SUCCESS; + } else { //If the email is not associated with an account + addFieldError("email", + getText(n_("vradi.forgotPassword.emailDoesntExist"))); + } + } + } + } catch (Exception e) { + addActionError(getText(n_("vradi.error.internal"))); + log.error(e.getMessage(), e); + } + return result; + } +} \ No newline at end of file Added: trunk/vradi-web/src/main/java/org/chorem/vradi/actions/HomeAction.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/actions/HomeAction.java (rev 0) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/actions/HomeAction.java 2011-05-20 14:08:45 UTC (rev 32) @@ -0,0 +1,18 @@ +package org.chorem.vradi.actions; + +/** + * Prepare l'affichage de la page d'accueil + * + * @author poussin + */ +public class HomeAction extends VradiBaseAction { + + private static final long serialVersionUID = -3735250067223062719L; + + /** + * Initializes everything before displaying the home page + */ + public String execute() { + return SUCCESS; + } +} \ No newline at end of file Added: trunk/vradi-web/src/main/java/org/chorem/vradi/actions/LoginAction.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/actions/LoginAction.java (rev 0) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/actions/LoginAction.java 2011-05-20 14:08:45 UTC (rev 32) @@ -0,0 +1,84 @@ +package org.chorem.vradi.actions; + +import org.chorem.vradi.entities.VradiUser; +import org.nuiton.util.StringUtil; +import org.nuiton.wikitty.search.Criteria; +import org.nuiton.wikitty.WikittyProxy; +import org.nuiton.wikitty.search.Search; + +import static org.nuiton.i18n.I18n.n_; + +/** + * authentifie l'utilisateur et place son objet User dans la vradi session + * + * @author poussin + */ +public class LoginAction extends VradiBaseAction { + + private static final long serialVersionUID = 6891064800288772246L; + + protected String email; + protected String password; + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + /** + * Check password in solr index, if fail try to check password admin in config file + * + * @param email email login + * @param password password + * @return null if not found + */ + protected VradiUser checkLogin(String email, String password) { + VradiUser result = null; + if (email != null && password != null) { + if (!email.isEmpty() && !password.equals(StringUtil.encodeMD5(""))) { + WikittyProxy proxy = getProxy(); + Criteria criteria = Search.query().eq(VradiUser.FQ_FIELD_WIKITTYUSER_LOGIN, email). + eq(VradiUser.FQ_FIELD_WIKITTYUSER_PASSWORD, password).criteria(); + result = proxy.findByCriteria(VradiUser.class, criteria); + } + } + return result; + } + + /** + * Authenticates the user if his email and password are valid + */ + public String execute() { + String result = INPUT; + + try { + if (email != null) { + email = email.trim(); + + if (password != null) { + String md5 = StringUtil.encodeMD5(password); + VradiUser user = checkLogin(email, md5); + if (user != null) { + getVradiSession().setUser(user); + result = SUCCESS; + } + } + } + } catch (Exception e) { + addActionError(getText(n_("vradi.error.internal"))); + log.error(e.getMessage(), e); + } + return result; + } +} \ No newline at end of file Added: trunk/vradi-web/src/main/java/org/chorem/vradi/actions/LogoutAction.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/actions/LogoutAction.java (rev 0) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/actions/LogoutAction.java 2011-05-20 14:08:45 UTC (rev 32) @@ -0,0 +1,11 @@ +package org.chorem.vradi.actions; + +/** + * Created by IntelliJ IDEA. + * User: letellier + * Date: 19/05/11 + * Time: 12:05 + * To change this template use File | Settings | File Templates. + */ +public class LogoutAction { +} Added: trunk/vradi-web/src/main/java/org/chorem/vradi/actions/RegisterAction.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/actions/RegisterAction.java (rev 0) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/actions/RegisterAction.java 2011-05-20 14:08:45 UTC (rev 32) @@ -0,0 +1,160 @@ +package org.chorem.vradi.actions; + +import javax.mail.MessagingException; +import javax.mail.internet.AddressException; +import javax.servlet.http.HttpServletRequest; + +import org.apache.struts2.interceptor.ServletRequestAware; +import org.chorem.vradi.entities.VradiUser; +import org.chorem.vradi.entities.VradiUserImpl; +import org.chorem.vradi.services.managers.MailingManager; +import org.nuiton.util.StringUtil; +import org.nuiton.wikitty.search.Criteria; +import org.nuiton.wikitty.WikittyProxy; +import org.nuiton.wikitty.search.Search; + +import static org.nuiton.i18n.I18n.n_; + +/** + * Enregistre un nouvel utilisateur + * + * @author poussin + */ +public class RegisterAction extends VradiBaseAction implements ServletRequestAware { + private static final long serialVersionUID = 2204772861770399542L; + protected String email; + protected String password; + protected String repeatPassword; + protected HttpServletRequest request; + + /** + * @return the email + */ + public String getEmail() { + return email; + } + + /** + * @param email the email to set + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * @return the password + */ + public String getPassword() { + return password; + } + + /** + * @param password the password to set + */ + public void setPassword(String password) { + this.password = password; + } + + /** + * @return the repeatPassword + */ + public String getRepeatPassword() { + return repeatPassword; + } + + /** + * @param repeatPassword the repeatPassword to set + */ + public void setRepeatPassword(String repeatPassword) { + this.repeatPassword = repeatPassword; + } + + @Override + public void setServletRequest(HttpServletRequest request) { + this.request = request; + } + + /** + * + * @param passwordMD5 the user password hashed in md5 + * @return false if the email address isn't already registered, true + * otherwise + */ + protected boolean alreadyRegistered(String passwordMD5) { + boolean result = true; + + if (email != null && passwordMD5 != null) { + if (!email.isEmpty() && !passwordMD5.equals(StringUtil.encodeMD5(""))) { + WikittyProxy proxy = getProxy(); + Criteria criteria = Search.query().eq(VradiUser.FQ_FIELD_WIKITTYUSER_LOGIN, email).criteria(); //Retrieves user by user name (email) + + //If the user doesn't already exist + if (proxy.findByCriteria(VradiUser.class, criteria) == null) { + result = false; + } else { //The email address is already used by someone + addFieldError("email", getText(n_("vradi.register.emailAldyUsed"))); + } + } + } + return result; + } + + /** + * Registers the new user and sends an email to confirm registration + */ + public String execute() { + String result = INPUT; + + try { + if (email != null) { + email = email.trim(); + if (password != null) { + if (!password.equals(repeatPassword)) { + addActionError(getText(n_("vradi.register.pwdDontMatch"))); + } else { + String md5 = StringUtil.encodeMD5(password); + + //If the email address isn't already used + if (!alreadyRegistered(md5)) { + WikittyProxy proxy = getProxy(); + VradiUserImpl newUser = new VradiUserImpl(); + newUser.setPassword(md5); + newUser.setLogin(email); + VradiUser login = proxy.store(newUser); //Stores the new user + + //If there was an error when storing the user + if (login == null) { + addFieldError("email", getText(n_("vradi.register.invalidLogin"))); + } else { + getVradiSession().setUser(login); + + try { + String mailContent; + + mailContent = getText(n_("vradi.register.mailHi")) + ",\n\n" + getText(n_("vradi.register.mailPwd")) + ": " + password + "\n\n" + getText(n_("bow.register.mailEmail")) + ": " + email + "\n\n"; + MailingManager.postMail(getConfig(), email, getText(n_("vradi.register.mailSubject")), false, mailContent); + } catch (AddressException e) { + //If the email address is invalid + String message = getText("vradi.mail.badFormat"); + + addActionError(n_(message)); + log.error(message + " (email:" + email + ")", e); + } catch (MessagingException e) { + String message = getText("vradi.mail.sendError"); + + addActionError(n_(message)); + log.error(message + "(" + e.getMessage() + ")", e); + } + result = SUCCESS; + } + } + } + } + } + } catch (Exception e) { + addActionError(getText(n_("vradi.error.internal"))); + log.error(e.getMessage(), e); + } + return result; + } +} Added: trunk/vradi-web/src/main/java/org/chorem/vradi/actions/VradiBaseAction.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/actions/VradiBaseAction.java (rev 0) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/actions/VradiBaseAction.java 2011-05-20 14:08:45 UTC (rev 32) @@ -0,0 +1,124 @@ +package org.chorem.vradi.actions; + +import com.opensymphony.xwork2.ActionSupport; +import com.opensymphony.xwork2.util.ValueStack; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import java.util.List; +import java.util.Map; +import org.apache.struts2.interceptor.SessionAware; +import org.chorem.vradi.VradiSession; +import org.nuiton.util.ApplicationConfig; +import org.nuiton.wikitty.WikittyProxy; + +/** + * TODO sletellier 20110519 : move this method to nuiton utils web + * + * Base class which must be extended by every action + * Overrides the Struts2 methods to render text in order to explicitly show + * the missing i18n translations + * Allows access to the session and the proxy + */ +public class VradiBaseAction extends ActionSupport implements SessionAware { + + private static final long serialVersionUID = 1L; + + protected static final Log log = LogFactory.getLog(VradiBaseAction.class); + + public static final String UNTRANSLATED_MARKER = "???"; + + protected Map<String, Object> session; + + public VradiSession getVradiSession() { + VradiSession result = VradiSession.getVradiSession(session); + return result; + } + + public WikittyProxy getProxy() { + WikittyProxy result = getVradiSession().getProxy(); + return result; + } + + public ApplicationConfig getConfig() { + return getVradiSession().getConfig(); + } + + @Override + public void setSession(Map<String, Object> session) { + this.session = session; + } + + @Override + public String getText(String aTextName) { + String value = super.getText(aTextName); + return getSafeText(aTextName, value); + } + + @Override + public String getText(String aTextName, String defaultValue) { + String value = super.getText(aTextName, defaultValue); + return getSafeText(aTextName, value); + } + + @Override + public String getText(String aTextName, String defaultValue, String obj) { + String value = super.getText(aTextName, defaultValue, obj); + return getSafeText(aTextName, value); + } + + @Override + public String getText(String aTextName, List<?> args) { + String value = super.getText(aTextName, args); + return getSafeText(aTextName, value); + } + + @Override + public String getText(String key, String[] args) { + String value = super.getText(key, args); + return getSafeText(key, value); + } + + @Override + public String getText(String aTextName, String defaultValue, List<?> args) { + String value = super.getText(aTextName, defaultValue, args); + return getSafeText(aTextName, value); + } + + @Override + public String getText(String key, String defaultValue, String[] args) { + String value = super.getText(key, defaultValue, args); + return getSafeText(key, value); + } + + @Override + public String getText(String key, String defaultValue, List<?> args, + ValueStack stack) { + String value = super.getText(key, defaultValue, args, stack); + return getSafeText(key, value); + } + + @Override + public String getText(String key, String defaultValue, String[] args, + ValueStack stack) { + String value = super.getText(key, defaultValue, args, stack); + return getSafeText(key, value); + } + + /** + * Surrounds the non translated keys with a marker to make them visible + * + * @param key i18n key + * @param value text to check + * @return translated text + */ + protected String getSafeText(String key, String value) { + if (StringUtils.isEmpty(value)) { + if (log.isWarnEnabled()) { + log.warn("Key [" + key + "] is not translated"); + } + return UNTRANSLATED_MARKER + key + UNTRANSLATED_MARKER; + } + return value; + } +} \ No newline at end of file Added: trunk/vradi-web/src/main/java/org/chorem/vradi/interceptors/LoginInterceptor.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/interceptors/LoginInterceptor.java (rev 0) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/interceptors/LoginInterceptor.java 2011-05-20 14:08:45 UTC (rev 32) @@ -0,0 +1,46 @@ +package org.chorem.vradi.interceptors; + +import java.util.Map; + +import org.apache.struts2.ServletActionContext; + +import com.opensymphony.xwork2.ActionContext; +import com.opensymphony.xwork2.ActionInvocation; +import com.opensymphony.xwork2.interceptor.AbstractInterceptor; +import org.chorem.vradi.VradiSession; +import org.chorem.vradi.entities.VradiUser; + +/** + * Interceptor used to loginRedirect a non-logged user if he tries to access a page + * where logging is mandatory + */ +public class LoginInterceptor extends AbstractInterceptor { + private static final long serialVersionUID = -7520186185205372272L; + + protected String loginRedirect; + + /** + * @param loginRedirect the loginRedirect to set + */ + public void setLoginRedirect(String loginRedirect) { + this.loginRedirect = loginRedirect; + } + + @Override + public String intercept(ActionInvocation invocation) throws Exception { + Map<String, Object> session = ActionContext.getContext().getSession(); + + VradiSession vradiSession = VradiSession.getVradiSession(session); + VradiUser user = vradiSession.getUser(); + String result = null; + + //If the user isn't logged in + if (user == null) { + ServletActionContext.getResponse().sendRedirect(loginRedirect); + } else { + result = invocation.invoke(); + } + + return result; + } +} Added: trunk/vradi-web/src/main/java/org/chorem/vradi/interceptors/LogoutInterceptor.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/interceptors/LogoutInterceptor.java (rev 0) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/interceptors/LogoutInterceptor.java 2011-05-20 14:08:45 UTC (rev 32) @@ -0,0 +1,23 @@ +package org.chorem.vradi.interceptors; + +import java.util.Map; + +import com.opensymphony.xwork2.ActionContext; +import com.opensymphony.xwork2.ActionInvocation; +import com.opensymphony.xwork2.interceptor.AbstractInterceptor; +import org.chorem.vradi.VradiSession; + +/** + * Interceptor used to remove all trace of user in session. Used for login page + */ +public class LogoutInterceptor extends AbstractInterceptor { + private static final long serialVersionUID = -7520186185205372272L; + + @Override + public String intercept(ActionInvocation invocation) throws Exception { + Map<String, Object> session = ActionContext.getContext().getSession(); + VradiSession.getVradiSession(session).invalidate(); + String result = invocation.invoke(); + return result; + } +} Modified: trunk/vradi-web/src/main/resources/i18n/vradi-web_en_GB.properties =================================================================== --- trunk/vradi-web/src/main/resources/i18n/vradi-web_en_GB.properties 2011-05-18 15:56:32 UTC (rev 31) +++ trunk/vradi-web/src/main/resources/i18n/vradi-web_en_GB.properties 2011-05-20 14:08:45 UTC (rev 32) @@ -3,4 +3,22 @@ vradi.config.last.version.description=Last started version vradi.config.remote.endpoint.description=Url of vradi service vradi.config.ui.locale=Vradi web locale -vradi.config.version.description=Vradi web version \ No newline at end of file +vradi.config.version.description=Vradi web version +vradi.register.emailAldyUsed=This address mail is already used +vradi.register.invalidLogin=An error occured during login +vradi.register.pwdDontMatch=Both passwords doesn't matches +vradi.error.internal=Error occured, thaks contact an admin +vradi.forgotPassword.emailDoesntExist=This email address doesn't exist +vradi.forgotpwd.submit=Send +vradi.forgotpwd.title=You are forgotten your password ? +vradi.login.email=Email +vradi.login.password=Password +vradi.login.repeatPassword=Confirm +vradi.login.submit=Please retape your password +vradi.login.title=Connection +vradi.register.mailEmail=Your email +vradi.register.mailHi=Hello +vradi.register.mailPwd=Your password +vradi.register.mailSubject=[Vradi] Your user informations +vradi.register.submit=Login +vradi.register.title=Login \ No newline at end of file Modified: trunk/vradi-web/src/main/resources/i18n/vradi-web_fr_FR.properties =================================================================== --- trunk/vradi-web/src/main/resources/i18n/vradi-web_fr_FR.properties 2011-05-18 15:56:32 UTC (rev 31) +++ trunk/vradi-web/src/main/resources/i18n/vradi-web_fr_FR.properties 2011-05-20 14:08:45 UTC (rev 32) @@ -1,3 +1,4 @@ +bow.register.mailEmail= vradi.config.configFileName.description=Fichier de configuration de Vradi web vradi.config.database.version.description=Version de la base de donnée vradi.config.last.version.description=Dernière version de Vradi web lancée @@ -4,3 +5,21 @@ vradi.config.remote.endpoint.description=Url de l'addresse de Vradi service vradi.config.ui.locale=Locale de l'instance de Vradi web vradi.config.version.description=Version de Vradi web +vradi.error.internal=Une erreur interne est survenue, merci de contacter un administrateur si cette erreur persiste +vradi.forgotPassword.emailDoesntExist=Cette adresse email n''existe pas +vradi.forgotpwd.submit=Envoyer +vradi.forgotpwd.title=Vous avez oublié votre mot de passe ? +vradi.login.email=Email +vradi.login.password=Mot de passe +vradi.login.repeatPassword=Confiramtion +vradi.login.submit=Veuillez retaper votre mot de passe +vradi.login.title=Connection +vradi.register.emailAldyUsed=Cette adresse email est déjà utilisée +vradi.register.invalidLogin=Une erreur s''est produite pendant l''enregistrement de vos informations, merci d''essayer à nouveau +vradi.register.mailEmail=Votre email +vradi.register.mailHi=Bonjour +vradi.register.mailPwd=Votre mot de passe +vradi.register.mailSubject=[Vradi] Vos informations utilisateurs +vradi.register.pwdDontMatch=Les mots de passe sont différents +vradi.register.submit=S''enregistrer +vradi.register.title=S''enregistrer Added: trunk/vradi-web/src/main/resources/struts.properties =================================================================== --- trunk/vradi-web/src/main/resources/struts.properties (rev 0) +++ trunk/vradi-web/src/main/resources/struts.properties 2011-05-20 14:08:45 UTC (rev 32) @@ -0,0 +1,45 @@ +struts.locale=fr_FR +struts.i18n.encoding=UTF-8 + +# struts.multipart.parser=cos +# struts.multipart.parser=pell +struts.multipart.parser=jakarta +# uses javax.servlet.context.tempdir by default +struts.multipart.saveDir= +struts.multipart.maxSize=2097152 + +# struts.custom.properties=application,com/webwork/extension/custom + +#struts.mapper.class=org.apache.struts2.dispatcher.mapper.DefaultActionMapper + +struts.action.extension=action + +struts.serve.static=true + +struts.serve.static.browserCache=true + +struts.tag.altSyntax=true + +struts.devMode=true + +struts.i18n.reload=true + +struts.ui.theme=xhtml +struts.ui.templateDir=template +#sets the default template type. Either ftl, vm, or jsp +struts.ui.templateSuffix=ftl + +struts.configuration.xml.reload=false + +struts.url.http.port = 80 +struts.url.https.port = 443 + +struts.custom.i18n.resources=vradi-web-i18n + +struts.dispatcher.parametersWorkaround = false + +#struts.freemarker.manager.classname=org.apache.struts2.views.freemarker.FreemarkerManager + +struts.freemarker.wrapper.altMap=true + +struts.xslt.nocache=false Modified: trunk/vradi-web/src/main/resources/struts.xml =================================================================== --- trunk/vradi-web/src/main/resources/struts.xml 2011-05-18 15:56:32 UTC (rev 31) +++ trunk/vradi-web/src/main/resources/struts.xml 2011-05-20 14:08:45 UTC (rev 32) @@ -1,28 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - bow - $Id: struts.xml 276 2011-04-29 21:02:55Z bpoussin $ - $HeadURL: http://svn.chorem.org/svn/bow/trunk/bow-ui/src/main/resources/struts.xml $ - %% - Copyright (C) 2010 - 2011 CodeLutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - #L% - --> - <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> @@ -38,10 +15,7 @@ <package name="publicArea" extends="struts-default"> <interceptors> <interceptor-stack name="publicAreaStack"> - <interceptor-ref name="defaultStack"> - <param name="store.operationMode">AUTOMATIC</param> - <param name="fileUpload.allowedExtensions">.html</param> - </interceptor-ref> + <interceptor-ref name="defaultStack"/> </interceptor-stack> </interceptors> <default-interceptor-ref name="publicAreaStack"/> @@ -51,50 +25,58 @@ | Definition d'un package pour l'espace des page de login | - ajout de l'intercepteur qui verifie que la personne est bien identifiee +--> - <!--<package name="loginArea" extends="publicArea">--> - <!--<interceptors>--> - <!--<interceptor name="logout" class="org.chorem.bow.interceptor.LogoutInterceptor"/>--> - <!--<interceptor-stack name="loginAreaStack">--> - <!--<interceptor-ref name="logout"/>--> - <!--<interceptor-ref name="publicAreaStack"/>--> - <!--</interceptor-stack>--> - <!--</interceptors>--> - <!--<default-interceptor-ref name="loginAreaStack"/>--> - <!--</package>--> + <package name="loginArea" extends="publicArea"> + <interceptors> + <interceptor name="logout" class="org.chorem.vradi.interceptors.LogoutInterceptor"/> + <interceptor-stack name="loginAreaStack"> + <interceptor-ref name="logout"/> + <interceptor-ref name="publicAreaStack"/> + </interceptor-stack> + </interceptors> + <default-interceptor-ref name="loginAreaStack"/> + </package> <!-- | Definition d'un package pour l'espace prive | - ajout de l'intercepteur qui verifie que la personne est bien identifiee +--> - <!--<package name="restrictedArea" extends="publicArea">--> - <!--<interceptors>--> - <!--<interceptor name="login" class="org.chorem.bow.interceptor.LoginInterceptor">--> - <!--<param name="redirect">login_input.action</param>--> - <!--</interceptor>--> - <!--<interceptor-stack name="restrictedAreaStack">--> - <!--<interceptor-ref name="login"/>--> - <!--<interceptor-ref name="publicAreaStack"/>--> - <!--</interceptor-stack>--> - <!--</interceptors>--> - <!--<default-interceptor-ref name="restrictedAreaStack"/>--> - <!--</package>--> + <package name="restrictedArea" extends="publicArea"> + <interceptors> + <interceptor name="login" class="org.chorem.vradi.interceptors.LoginInterceptor"> + <param name="loginRedirect">login.action</param> + </interceptor> + <interceptor-stack name="restrictedAreaStack"> + <interceptor-ref name="login"/> + <interceptor-ref name="publicAreaStack"/> + </interceptor-stack> + </interceptors> + <default-interceptor-ref name="restrictedAreaStack"/> + </package> - <!--<package name="login" extends="loginArea">--> - <!--<action name="register_*" method="{1}" class="org.chorem.bow.action.RegisterAction">--> - <!--<result name="input">/jsp/register.jsp</result>--> - <!--<result type="redirectAction">home</result>--> - <!--</action>--> - <!--<action name="forgotPassword_*" method="{1}" class="org.chorem.bow.action.ForgotPasswordAction">--> - <!--<result name="input">/jsp/forgotPassword.jsp</result>--> - <!--<result type="redirectAction">login_input</result>--> - <!--</action>--> - <!--<action name="login_*" method="{1}" class="org.chorem.bow.action.LoginAction">--> - <!--<result name="input">/jsp/login.jsp</result>--> - <!--<result name="login" type="redirectAction">home</result>--> - <!--<result type="redirectAction">home</result>--> - <!--</action>--> - <!--<action name="logout" class="org.chorem.bow.action.LogoutAction">--> - <!--<result type="redirectAction">login_input</result>--> - <!--</action>--> - <!--</package>--> + <package name="login" extends="loginArea"> + <action name="register_*" method="{1}" class="org.chorem.vradi.actions.RegisterAction"> + <result name="input">/jsp/register.jsp</result> + <result type="redirectAction">home</result> + </action> + <action name="forgotPassword_*" method="{1}" class="org.chorem.vradi.actions.ForgotPasswordAction"> + <result name="input">/jsp/forgotPassword.jsp</result> + <result type="redirectAction">login_input</result> + </action> + <action name="login_*" method="{1}" class="org.chorem.vradi.actions.LoginAction"> + <result name="input">/jsp/login.jsp</result> + <result name="login" type="redirectAction">home</result> + <result type="redirectAction">home</result> + </action> + <action name="logout" class="org.chorem.vradi.actions.LogoutAction"> + <result type="redirectAction">login_input</result> + </action> + </package> + + <package name="misc" extends="restrictedArea"> + <action name="home" class="org.chorem.vradi.actions.HomeAction"> + <result>/jsp/home.jsp</result> + <result name="input" type="redirectAction">home</result> + </action> + </package> + </struts> Modified: trunk/vradi-web/src/main/resources/vradi-web.properties =================================================================== --- trunk/vradi-web/src/main/resources/vradi-web.properties 2011-05-18 15:56:32 UTC (rev 31) +++ trunk/vradi-web/src/main/resources/vradi-web.properties 2011-05-20 14:08:45 UTC (rev 32) @@ -0,0 +1,23 @@ +application.name=${project.name} +application.version=${project.version} +application.site.url=http://maven-site.chorem.org/vradi/index.html +#licence.name=${project.licenses[0].license.name} +#licence.url=${project.licenses.0.url} +application.organisation.name=${project.organization.name} +application.organisation.url=${project.organization.url} + +# Wikitty +wikitty.WikittyService.components=org.nuiton.wikitty.services.WikittyServiceHessianClient,\ +org.nuiton.wikitty.services.WikittyServiceNotifier,\ +org.nuiton.wikitty.services.WikittyServiceCached,\ +org.nuiton.wikitty.services.WikittyServiceSecurity +wikitty.service.cache.allwaysRestoreCopies=false +wikitty.service.event.propagate=false +wikitty.service.event.listen=true +wikitty.service.event.propagate.transporter=org.nuiton.wikitty.services.XMPPNotifierTransporter +wikitty.WikittyServiceCached.components=org.nuiton.wikitty.services.WikittyCacheJCS +wikitty.service.server.url=${vradi.remote.endpoint}/wikittyservice +wikitty.service.cache.priority.extensions=Thesaurus, User, Status, XmlStream +jcs.default= +jcs.default.cacheattributes.MaxObjects=1000 +jcs.priority.cacheattributes.MaxObjects=10000 Modified: trunk/vradi-web/src/main/webapp/WEB-INF/web.xml =================================================================== --- trunk/vradi-web/src/main/webapp/WEB-INF/web.xml 2011-05-18 15:56:32 UTC (rev 31) +++ trunk/vradi-web/src/main/webapp/WEB-INF/web.xml 2011-05-20 14:08:45 UTC (rev 32) @@ -31,31 +31,18 @@ <!-- Filters --> <filter> - <filter-name>action2-cleanup</filter-name> - <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class> - </filter> - <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter> <filter-mapping> - <filter-name>action2-cleanup</filter-name> - <url-pattern>/*</url-pattern> - </filter-mapping> - <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- Welcome file lists --> <welcome-file-list> - <welcome-file>index.jsp</welcome-file> + <welcome-file>index.html</welcome-file> </welcome-file-list> - <jsp-config> - <jsp-property-group> - <url-pattern>*.jsp</url-pattern> - </jsp-property-group> - </jsp-config> </web-app> Copied: trunk/vradi-web/src/main/webapp/index.html (from rev 31, trunk/vradi-web/src/main/webapp/index.jsp) =================================================================== --- trunk/vradi-web/src/main/webapp/index.html (rev 0) +++ trunk/vradi-web/src/main/webapp/index.html 2011-05-20 14:08:45 UTC (rev 32) @@ -0,0 +1,11 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta http-equiv="refresh" content="0;URL=home.action"/> + <title>Vradi web</title> + </head> + + <body onload=""> + + </body> +</html> \ No newline at end of file Deleted: trunk/vradi-web/src/main/webapp/index.jsp =================================================================== --- trunk/vradi-web/src/main/webapp/index.jsp 2011-05-18 15:56:32 UTC (rev 31) +++ trunk/vradi-web/src/main/webapp/index.jsp 2011-05-20 14:08:45 UTC (rev 32) @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <%--<meta http-equiv="refresh" content="0;URL=home.action?request_locale=fr_FR"/>--%> - <title>Vradi web</title> - </head> - - <body onload=""> - - </body> -</html> \ No newline at end of file Added: trunk/vradi-web/src/main/webapp/jsp/forgotPassword.jsp =================================================================== --- trunk/vradi-web/src/main/webapp/jsp/forgotPassword.jsp (rev 0) +++ trunk/vradi-web/src/main/webapp/jsp/forgotPassword.jsp 2011-05-20 14:08:45 UTC (rev 32) @@ -0,0 +1,24 @@ +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@taglib prefix="s" uri="/struts-tags" %> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" + xmlns:jsp="http://java.sun.com/JSP/Page"> + <head> + <title><s:text name="vradi.forgotpwd.title" /></title> + <s:head /> + </head> + <body> + <div id="content"> + <div id="formFrame fond"> + <h1><s:text name="vradi.forgotpwd.title" /></h1> + <s:form action="forgotPassword"> + <p> + <s:textfield key="vradi.login.email" name="email" labelposition="top" labelSeparator=" :" /> + <s:submit key="vradi.forgotpwd.submit" name="submit" /> + </p> + </s:form> + <s:a action="login_input" id="loginLink"><s:text name="vradi.login.title" /></s:a> + </div> + </div> + </body> +</html> Added: trunk/vradi-web/src/main/webapp/jsp/home.jsp =================================================================== --- trunk/vradi-web/src/main/webapp/jsp/home.jsp (rev 0) +++ trunk/vradi-web/src/main/webapp/jsp/home.jsp 2011-05-20 14:08:45 UTC (rev 32) @@ -0,0 +1,5 @@ +<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%> +<html> +<head><title>Simple jsp page</title></head> +<body>Place your content here</body> +</html> \ No newline at end of file Added: trunk/vradi-web/src/main/webapp/jsp/login.jsp =================================================================== --- trunk/vradi-web/src/main/webapp/jsp/login.jsp (rev 0) +++ trunk/vradi-web/src/main/webapp/jsp/login.jsp 2011-05-20 14:08:45 UTC (rev 32) @@ -0,0 +1,27 @@ +<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@taglib prefix="s" uri="/struts-tags"%> + +<html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" + xmlns:jsp="http://java.sun.com/JSP/Page"> + <head> + <title><s:text name="vradi.login.title" /></title> + <s:head /> + </head> + <body> + <div id="content"> + <div id="formFrame" class="fond"> + <h1><s:text name="vradi.login.title" /></h1> + <br/> + <br/> + <s:actionerror /> + <s:form action="login"> + <s:textfield key="vradi.login.email" name="email" labelposition="top" labelSeparator=" :" /> + <s:password key="vradi.login.password" name="password" labelposition="top" labelSeparator=" :" /> + <s:submit key="vradi.login.submit" name="submit" /> + </s:form> + <s:a action="register_input" id="registerLink"><s:text name="vradi.register.title" /></s:a><br /> + <s:a action="forgotPassword_input" id="forgotPwd"><s:text name="vradi.forgotpwd.title" /></s:a> + </div> + </div> + </body> +</html> Added: trunk/vradi-web/src/main/webapp/jsp/register.jsp =================================================================== --- trunk/vradi-web/src/main/webapp/jsp/register.jsp (rev 0) +++ trunk/vradi-web/src/main/webapp/jsp/register.jsp 2011-05-20 14:08:45 UTC (rev 32) @@ -0,0 +1,27 @@ +<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@taglib prefix="s" uri="/struts-tags" %> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" + xmlns:jsp="http://java.sun.com/JSP/Page"> + <head> + <title><s:text name="vradi.register.title" /></title> + <s:head /> + </head> + <body> + <div id="content"> + <div id="formFrame" class="fond"> + <h1><s:text name="vradi.register.title" /></h1> + <s:form action="register"> + <s:actionerror /> + <p> + <s:textfield key="vradi.login.email" name="email" labelposition="top" labelSeparator=" :" /> + <s:password key="vradi.login.password" name="password" labelposition="top" labelSeparator=" :" /> + <s:password key="vradi.login.repeatPassword" name="repeatPassword" labelposition="top" labelSeparator=" :" /> + <s:submit key="vradi.register.submit" name="submit" /> + </p> + </s:form> + <s:a action="login_input" id="loginLink"><s:text name="vradi.login.title" /></s:a> + </div> + </div> + </body> +</html>
participants (1)
-
sletellier@users.chorem.org