r3259 - in branches/pollen-1.2.6-struts2: pollen-services/src/main/java/org/chorem/pollen/services/exceptions pollen-services/src/main/java/org/chorem/pollen/services/impl pollen-services/src/main/resources/i18n pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user pollen-ui-struts2/src/main/resources pollen-ui-struts2/src/main/resources/config pollen-ui-struts2/src/main/resources/i18n pollen-ui-struts2/src/main/webapp/WEB-INF pollen-ui-struts2/src/main/webapp/WEB-INF/decorators
Author: fdesbois Date: 2012-04-13 17:41:42 +0200 (Fri, 13 Apr 2012) New Revision: 3259 Url: http://chorem.org/repositories/revision/pollen/3259 Log: fixes #86 : lost password link Added: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/InvalidEmailException.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/LostPassword.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/dialogLostPassword.jsp Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/EmailService.java branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/SendMail.java branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/UserService.java branches/pollen-1.2.6-struts2/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties branches/pollen-1.2.6-struts2/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-user.xml branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/shiro.ini branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators.xml branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp Added: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/InvalidEmailException.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/InvalidEmailException.java (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/InvalidEmailException.java 2012-04-13 15:41:42 UTC (rev 3259) @@ -0,0 +1,12 @@ +package org.chorem.pollen.services.exceptions; + +/** + * Created: 13/04/12 + * + * @author fdesbois <desbois@codelutin.com> + * @since 1.3 + */ +public class InvalidEmailException extends Exception { + + private static final long serialVersionUID = 1L; +} Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/EmailService.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/EmailService.java 2012-04-13 15:41:30 UTC (rev 3258) +++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/EmailService.java 2012-04-13 15:41:42 UTC (rev 3259) @@ -64,14 +64,36 @@ user.getDisplayName(), user.getLogin(), user.getPassword(), url); - PollEmail pollEmail = createPollEmail(user.getEmail(), - subject, - content); + PollenEmail pollenEmail = createPollenEmail(user.getEmail(), + subject, + content); - sendEmail(pollEmail); + sendEmail(pollenEmail); } } + public void onLostPassword(UserAccount user, String newPassword) { + + URL url = serviceContext.getApplicationURL(); + + if (url != null) { + + Locale locale = getLocale(); + + String subject = l_(locale, "pollen.email.lostPassword.subject", + user.getLogin()); + String content = l_(locale, "pollen.email.lostPassword.content", + user.getDisplayName(), + user.getLogin(), newPassword, url); + + PollenEmail pollenEmail = createPollenEmail(user.getEmail(), + subject, + content); + + sendEmail(pollenEmail); + } + } + public void onVoteAdded(Poll poll, PollUrl voteURL, PollUrl modifURL) { URL url = serviceContext.getApplicationURL(); @@ -93,10 +115,10 @@ String content = l_(locale, "pollen.email.voteEmail.content", pollTitle, nbVotes, voteURL, modifURL); - PollEmail pollEmail = createPollEmail( + PollenEmail pollenEmail = createPollenEmail( poll.getCreator().getEmail(), subject, content); - sendEmail(pollEmail); + sendEmail(pollenEmail); } } @@ -119,10 +141,10 @@ String content = l_(locale, "pollen.email.creatorEmail.content", pollTitle, voteURL, modifURL); - PollEmail pollEmail = createPollEmail( + PollenEmail pollenEmail = createPollenEmail( poll.getCreator().getEmail(), subject, content); - sendEmail(pollEmail); + sendEmail(pollenEmail); } // Mails à tous les votants @@ -132,13 +154,13 @@ String subject = l_(locale, "pollen.email.votingEmail.subject", pollTitle); - List<PollEmail> emails = Lists.newArrayList(); + List<PollenEmail> emails = Lists.newArrayList(); for (PollAccount account : votingPollAccounts) { - PollEmail pollEmail = + PollenEmail pollenEmail = createVotingEmail(locale, pollTitle, account, voteURL); - emails.add(pollEmail); + emails.add(pollenEmail); } sendEmail(emails); @@ -156,34 +178,13 @@ String pollTitle = poll.getTitle(); - PollEmail pollEmail = + PollenEmail pollenEmail = createVotingEmail(locale, pollTitle, account, voteURL); - sendEmail(pollEmail); + sendEmail(pollenEmail); } } - - private PollEmail createVotingEmail(Locale locale, - String pollTitle, - PollAccount account, - PollUrl voteURL) { - String subject = l_(locale, "pollen.email.votingEmail.subject", - pollTitle); - - PollUrl accountVoteURL = - PollUrl.newPollUrl(voteURL, account.getAccountId()); - - String content = - l_(locale, "pollen.email.votingEmail.content", - pollTitle, account.getVotingId(), accountVoteURL); - - PollEmail result = createPollEmail( - account.getEmail(), subject, content); - - return result; - } - public void onPollReminder(Poll poll, PollUrl voteURL) { URL url = serviceContext.getApplicationURL(); @@ -201,7 +202,7 @@ String subject = l_(locale, "pollen.email.reminderEmail.subject", pollTitle); - List<PollEmail> emails = Lists.newArrayList(); + List<PollenEmail> emails = Lists.newArrayList(); for (PollAccount account : votingPollAccounts) { PollUrl accountVoteURL = PollUrl.newPollUrl(voteURL, account.getAccountId()); @@ -210,21 +211,42 @@ l_(locale, "pollen.email.reminderEmail.content", pollTitle, account.getVotingId(), accountVoteURL); - PollEmail pollEmail = createPollEmail( + PollenEmail pollenEmail = createPollenEmail( account.getEmail(), subject, content); - emails.add(pollEmail); + emails.add(pollenEmail); } sendEmail(emails); } } } - protected void sendEmail(Iterable<PollEmail> pollEmails) { + private PollenEmail createVotingEmail(Locale locale, + String pollTitle, + PollAccount account, + PollUrl voteURL) { + String subject = l_(locale, "pollen.email.votingEmail.subject", + pollTitle); + + PollUrl accountVoteURL = + PollUrl.newPollUrl(voteURL, account.getAccountId()); + + String content = + l_(locale, "pollen.email.votingEmail.content", + pollTitle, account.getVotingId(), accountVoteURL); + + PollenEmail result = createPollenEmail( + account.getEmail(), subject, content); + + return result; + } + + protected void sendEmail(Iterable<PollenEmail> pollEmails) { + //TODO tchemit If two much mails then use SendEmail thread... - for (PollEmail pollEmail : pollEmails) { - sendEmail(pollEmail); + for (PollenEmail pollenEmail : pollEmails) { + sendEmail(pollenEmail); } // // send mail preparation @@ -239,17 +261,17 @@ } - protected void sendEmail(PollEmail pollEmail) { + protected void sendEmail(PollenEmail pollenEmail) { - Preconditions.checkNotNull(pollEmail); + Preconditions.checkNotNull(pollenEmail); - String to = pollEmail.getTo(); + String to = pollenEmail.getTo(); Preconditions.checkNotNull(to); - String subject = pollEmail.getSubject(); + String subject = pollenEmail.getSubject(); Preconditions.checkNotNull(subject); - String content = pollEmail.getContent(); + String content = pollenEmail.getContent(); Preconditions.checkNotNull(content); try { @@ -284,13 +306,13 @@ } } - public static PollEmail createPollEmail(String to, - String subject, - String content) { - return new PollEmail(to, subject, content); + public static PollenEmail createPollenEmail(String to, + String subject, + String content) { + return new PollenEmail(to, subject, content); } - public static class PollEmail { + public static class PollenEmail { protected String subject; @@ -299,7 +321,7 @@ protected String to; - private PollEmail(String to, String subject, String content) { + private PollenEmail(String to, String subject, String content) { this.subject = subject; this.content = content; this.to = to; Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/SendMail.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/SendMail.java 2012-04-13 15:41:30 UTC (rev 3258) +++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/SendMail.java 2012-04-13 15:41:42 UTC (rev 3259) @@ -191,13 +191,13 @@ // index contains next index to treat so == is ok if (currentIndex >= index) { - EmailService.PollEmail pollEmail = - EmailService.createPollEmail( + EmailService.PollenEmail pollenEmail = + EmailService.createPollenEmail( receiver, subject, body ); - emailService.sendEmail(pollEmail); + emailService.sendEmail(pollenEmail); // MailUtil.sendMail(configuration.getProperty("email_host"), // Integer.parseInt(configuration.getProperty("email_port")), @@ -249,7 +249,7 @@ * @throws IOException */ public void prepareMails(String id, - List<EmailService.PollEmail> mailData) throws IOException { + List<EmailService.PollenEmail> mailData) throws IOException { Writer fileWriter = null; CSVWriter cvsWriter = null; @@ -260,7 +260,7 @@ fileWriter = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(emailFile))); cvsWriter = new CSVWriter(fileWriter); - for (EmailService.PollEmail singleMailData : mailData) { + for (EmailService.PollenEmail singleMailData : mailData) { String[] nextLine = new String[]{ singleMailData.getTo(), singleMailData.getSubject(), Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/UserService.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/UserService.java 2012-04-13 15:41:30 UTC (rev 3258) +++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/UserService.java 2012-04-13 15:41:42 UTC (rev 3259) @@ -33,6 +33,7 @@ import org.chorem.pollen.business.persistence.UserAccountDAO; import org.chorem.pollen.entities.PollenBinderHelper; import org.chorem.pollen.services.PollenServiceSupport; +import org.chorem.pollen.services.exceptions.InvalidEmailException; import org.chorem.pollen.services.exceptions.UserEmailAlreadyUsedException; import org.chorem.pollen.services.exceptions.UserInvalidPasswordException; import org.chorem.pollen.services.exceptions.UserLoginAlreadyUsedException; @@ -101,7 +102,7 @@ if (byAdmin) { // let's generate the new password - password = RandomStringUtils.randomAlphanumeric(8); + password = generatePassword(); user.setPassword(password); } @@ -189,6 +190,47 @@ } } + /** + * This service is used to retrieve the userAccount associated to the given + * {@code email}. If the user is found, an email will be send with a new + * password. Otherwise an error will occured. + * + * @param email User email + * @throws InvalidEmailException if the email is not valid + * @throws UserNotFoundException if no user matches the given email + */ + public void lostPassword(String email) throws UserNotFoundException, InvalidEmailException { + + Preconditions.checkNotNull(email); + + if (!StringUtil.isEmail(email)) { + throw new InvalidEmailException(); + } + + UserAccount user; + UserAccountDAO dao = getDAO(UserAccount.class); + try { + user = dao.findByEmail(email); + } catch (TopiaException e) { + throw new PollenTechnicalException(e); + } + + if (user == null) { + throw new UserNotFoundException(); + } + + String newPassword = generatePassword(); + String encodedPassword = encodePassword(newPassword); + + user.setPassword(encodedPassword); + + // send the email + EmailService emailService = newService(EmailService.class); + emailService.onLostPassword(user, newPassword); + + commitTransaction("Can't update lost user password"); + } + public UserAccount getNewUser() { UserAccountDAO dao = getDAO(UserAccount.class); UserAccount result = newInstance(dao); @@ -260,6 +302,10 @@ } } + protected String generatePassword() { + return RandomStringUtils.randomAlphanumeric(8); + } + protected String encodePassword(String password) { return StringUtil.encodeMD5(password); } Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties =================================================================== --- branches/pollen-1.2.6-struts2/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties 2012-04-13 15:41:30 UTC (rev 3258) +++ branches/pollen-1.2.6-struts2/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties 2012-04-13 15:41:42 UTC (rev 3259) @@ -10,6 +10,8 @@ pollen.common.numberVote-total-votes=Total votes pollen.email.creatorEmail.content=You had just created the new poll\: "%s".\nYou can access to this poll by following the links below.\n\nVote page\: \n%s\nEdit page\: \n%s pollen.email.creatorEmail.subject=[Pollen] Poll creation (%s) +pollen.email.lostPassword.content=Hello %1$s. You have just asked for a new password generation for your Pollen account.\n\nLogin\: %2$s\nPassword\: %3$s\n\nYou can now manage your polls by logging on the website \: \n%4$s +pollen.email.lostPassword.subject=[Pollen] Lost password for %s pollen.email.reminderEmail.content=You have not yet voted for the poll "%s".\nYou can still participate with the identifier %s by following this link\: \n%s pollen.email.reminderEmail.subject=[Pollen] Reminder (%s) pollen.email.userRegister.content=Welcome %1$s. You had just created an account on the web application Pollen.\n\nLogin\: %2$s\nPassword\: %3$s\n\nYou can now manage your polls by logging on the website \: \n%4$s Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties =================================================================== --- branches/pollen-1.2.6-struts2/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties 2012-04-13 15:41:30 UTC (rev 3258) +++ branches/pollen-1.2.6-struts2/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties 2012-04-13 15:41:42 UTC (rev 3259) @@ -12,6 +12,8 @@ pollen.email.createPoll.subject=[Pollen] Création d'un sondage (%1$s) pollen.email.creatorEmail.content=Vous venez de créer le sondage "%s".\nVous pouvez y accéder en suivant les liens ci-dessous.\n\nPage de vote \: \n%s\nPage de modification \: \n%s pollen.email.creatorEmail.subject=[Pollen] Création d'un sondage (%s) +pollen.email.lostPassword.content=Bonjour %1$s. Vous venez de demander la génération d'un nouveau mot de passe d'accès à votre compte Pollen.\n\nIdentifiant \: %2$s\nMot de passe \: %3$s\n\nVous pouvez dès maintenant gérer vos sondages en vous identifiant sur le site \: \n%4$s +pollen.email.lostPassword.subject=[Pollen] Mot de passe perdu du compte %s pollen.email.reminderEmail.content=Vous n'avez pas encore voté pour le sondage "%s".\nVous pouvez encore y participer avec l'identifiant %s à l'adresse suivante \: \n%s pollen.email.reminderEmail.subject=[Pollen] Rappel (%s) pollen.email.userRegister.content=Bienvenue %1$s. Vous venez de créer un compte sur l'application de sondage en ligne Pollen.\n\nIdentifiant \: %2$s\nMot de passe \: %3$s\n\nVous pouvez dès maintenant gérer vos sondages en vous identifiant sur le site \: \n%4$s Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/LostPassword.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/LostPassword.java (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/LostPassword.java 2012-04-13 15:41:42 UTC (rev 3259) @@ -0,0 +1,49 @@ +package org.chorem.pollen.ui.actions.user; + +import org.apache.commons.lang.StringUtils; +import org.chorem.pollen.services.exceptions.UserNotFoundException; +import org.chorem.pollen.services.impl.UserService; +import org.chorem.pollen.ui.actions.PollenActionSupport; +import org.nuiton.util.StringUtil; + +/** + * Created: 13/04/12 + * + * @author fdesbois <desbois@codelutin.com> + * @since 1.3 + */ +public class LostPassword extends PollenActionSupport { + + private static final long serialVersionUID = 1L; + + private String email; + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @Override + public String execute() throws Exception { + + if (StringUtils.isBlank(email) || !StringUtil.isEmail(email)) { + addActionError( _("pollen.error.lostPassword.email")); + + } else { + + UserService service = newService(UserService.class); + try { + service.lostPassword(email); + + addActionMessage(_("pollen.information.lostPassword.success")); + + } catch (UserNotFoundException e) { + addActionError(_("pollen.error.lostPassword.user")); + } + } + return SUCCESS; + } +} Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-user.xml =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-user.xml 2012-04-13 15:41:30 UTC (rev 3258) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-user.xml 2012-04-13 15:41:42 UTC (rev 3259) @@ -58,6 +58,12 @@ </result> </action> + <!-- lost password --> + <action name="lostPassword" class="org.chorem.pollen.ui.actions.user.LostPassword"> + <result name="input">/WEB-INF/jsp/user/dialogLostPassword.jsp</result> + <result type="redirectToHome"/> + </action> + <!-- logout --> <action name="logout" class="org.chorem.pollen.ui.actions.user.Logout"> <result type="redirectToHome"/> Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-04-13 15:41:30 UTC (rev 3258) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-04-13 15:41:42 UTC (rev 3259) @@ -1,3 +1,4 @@ +email=E-mail pollen.action.addChoice=Add choice pollen.action.addComment=Add a comment pollen.action.addPersonToList=Add a voter @@ -39,6 +40,7 @@ pollen.action.pollVotingListDelete=Supprimer le groupe de votants pollen.action.pollVotingListEdit=Editer ce groupe de votants pollen.action.register=Register +pollen.action.send=Send pollen.action.validate=Submit pollen.common.aboutPoll=About the poll pollen.common.addingChoices=Adding choices @@ -131,6 +133,8 @@ pollen.error.favoriteList.participant.not.found.in.list=Member not found in favorite list pollen.error.favoriteListName.required=List name mandatory pollen.error.login.required=You must provide a login +pollen.error.lostPassword.email=The provided e-mail is not valid. +pollen.error.lostPassword.user=No user matches the given e-mail pollen.error.no.poll.found=Poll not found with id %s pollen.error.password.required=Your must provide a password pollen.error.password2.required=You must repeat your password for confirmation @@ -160,6 +164,7 @@ pollen.error.user.alreadyVoted=Someone has already used the name %s to vote. pollen.error.user.bad.login.or.password=Login or password invalid. pollen.error.user.email.already.used=This email is already used +pollen.error.user.invalid.email=Invalid e-mail pollen.error.user.invalid.password=Invalid password pollen.error.user.login.already.used=This login is already used pollen.error.user.not.found=User not found @@ -192,6 +197,7 @@ pollen.information.favoriteList.created=Favorite list %s created. pollen.information.favoriteList.deleted=Favorite list %s deleted. pollen.information.irreversible.operation=Be ware, this operation is irreversible. +pollen.information.lostPassword.success=An e-mail was sent with your new password. You can change it on your user account page. pollen.information.need.login=You must be logged to access this page. Please fill the form below. pollen.information.poll.created=Poll created pollen.information.poll.form.voteStarted=Votes are started, some options can't be updated. @@ -217,6 +223,7 @@ pollen.legend.login=Login pollen.legend.select.favoriteList.to.add=Sélectionner la liste de favoris à ajouter pollen.legend.select.personList.to.create.votingList=Sélectionner la liste des votant à importer dans le nouveau groupe +pollen.link.lostPassword=Forget password ? pollen.menu.admin=Administration pollen.menu.createPoll=Create a poll pollen.menu.home=Home Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-04-13 15:41:30 UTC (rev 3258) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-04-13 15:41:42 UTC (rev 3259) @@ -1,3 +1,4 @@ +email=E-mail pollen.action.addChoice=Ajouter un choix pollen.action.addComment=Ajouter un commentaire pollen.action.addPersonListFromVotingList=Ajouter des votants à partir d'une liste de votants @@ -44,6 +45,7 @@ pollen.action.pollVotingListDelete=Supprimer le groupe de votants pollen.action.pollVotingListEdit=Editer ce groupe de votants pollen.action.register=S'enregistrer +pollen.action.send=Envoyer pollen.action.validate=Valider pollen.common.aboutPoll=A propos du sondage pollen.common.addingChoices=Ajout des choix @@ -138,6 +140,8 @@ pollen.error.favoriteList.participant.not.found.in.list=Membre non trouvé dans la liste pollen.error.favoriteListName.required=Nom de liste obligatoire pollen.error.login.required=Login obligatoire +pollen.error.lostPassword.email=L'e-mail saisi n'est pas valide. +pollen.error.lostPassword.user=Aucun utilisateur correspond au courriel renseigné. pollen.error.no.poll.found=Sondage non trouvé avec l'id %s pollen.error.password.required=Mot de passe obligatoire pollen.error.password2.required=Mot de passe répété obligatoire @@ -167,6 +171,7 @@ pollen.error.user.alreadyVoted=Une personne a déjà voté sous le nom %s. pollen.error.user.bad.login.or.password=Mauvais identifiant ou mot de passe. pollen.error.user.email.already.used=Le courriel saisi est déjà utilisé par un autre utilisateur +pollen.error.user.invalid.email=E-mail invalide pollen.error.user.invalid.password=Mot de passe invalide pollen.error.user.login.already.used=Le login saisie est déjà utilisé par un autre utilisateur pollen.error.user.not.found=Utilisateur non trouvé @@ -200,6 +205,8 @@ pollen.information.favoriteList.created=La liste %s a été créée. pollen.information.favoriteList.deleted=La liste %s a été supprimée. pollen.information.irreversible.operation=Attention, Cette opération est irréversible. +pollen.information.lostPassword=Vous allez recevoir un nouveau mot de passe sur l'e-mail suivant +pollen.information.lostPassword.success=Un e-mail vous a été envoyé avec votre nouveau mot de passe. Vous pouvez le changer sur la page d'édition de votre compte. pollen.information.need.login=Vous devez être identifié pour pouvoir accéder à cette page. Veuillez remplir le formulaire ci-dessous. pollen.information.poll.created=Sondage créé pollen.information.poll.form.voteStarted=Les votes ont commencé, certaines options ne sont pas modifiables. @@ -225,6 +232,7 @@ pollen.legend.login=Login pollen.legend.select.favoriteList.to.add=Sélectionner la liste de favoris à ajouter pollen.legend.select.personList.to.create.votingList=Sélectionner la liste des votant à importer dans le nouveau groupe +pollen.link.lostPassword=Mot de passe oublié ? pollen.menu.admin=Administration pollen.menu.createPoll=Créer un sondage pollen.menu.home=Accueil Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/shiro.ini =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/shiro.ini 2012-04-13 15:41:30 UTC (rev 3258) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/shiro.ini 2012-04-13 15:41:42 UTC (rev 3259) @@ -18,8 +18,9 @@ [urls] # anon urls -/user/login = anon -/user/register** = anon +/user/login=anon +/user/register**=anon +/user/lostPassword**=anon # connected urls /user/**=connected Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp 2012-04-13 15:41:30 UTC (rev 3258) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp 2012-04-13 15:41:42 UTC (rev 3259) @@ -52,7 +52,19 @@ jQuery(document).ready(function () { // apply common style - $('fieldset').attr('class', 'ui-widget-content ui-corner-all') + $('fieldset').attr('class', 'ui-widget-content ui-corner-all'); + + // Popup for lostPassword + $('#lostPasswordLink').click(function() { + + $('.ui-dialog-title').html('<s:text name="pollen.link.lostPassword"/>'); + + var url = '<s:url action="lostPassword" method="input" namespace="/user"/>'; + var dialog = $("#lostPasswordDialog"); + dialog.load(url); + dialog.dialog('open'); + return false; + }); }); </script> <s:set var="user" value="%{#session.pollenSession.userAccount}"/> @@ -119,6 +131,9 @@ <div class="dropdown_menu" id="login_menu" style="display: none;"> <div class="top_right${pageLogo}"></div> <div class="top_left${pageLogo}"></div> + + <sj:dialog id="lostPasswordDialog" autoOpen="false" modal="true" width="500"/> + <s:form id="connection" method="POST" namespace="/user" action="login"> <ul class="top_middle${pageLogo}"> <li> @@ -136,6 +151,11 @@ label="" theme="simple"/> </li> <li> + <a id="lostPasswordLink"> + <s:text name="pollen.link.lostPassword"/> + </a> + </li> + <li> <s:submit id="submitform" action="login" key="pollen.action.login" align="right"/> </li> Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators.xml =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators.xml 2012-04-13 15:41:30 UTC (rev 3258) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators.xml 2012-04-13 15:41:42 UTC (rev 3259) @@ -29,10 +29,9 @@ <pattern>/images/*</pattern> <pattern>/config-browser/*</pattern> <pattern>/json/*</pattern> - <pattern>/user/confirm*</pattern> - <pattern>/admin/confirm*</pattern> - <pattern>/poll/confirm*</pattern> + <pattern>/*/confirm*</pattern> <pattern>/poll/display*</pattern> + <pattern>/user/lostPassword*</pattern> <pattern>/poll/importPersonList*</pattern> <pattern>/poll/selectPersonListTo*</pattern> <pattern>/io/*</pattern> Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/dialogLostPassword.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/dialogLostPassword.jsp (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/dialogLostPassword.jsp 2012-04-13 15:41:42 UTC (rev 3259) @@ -0,0 +1,50 @@ +<%-- + #%L + Pollen :: UI (strust2) + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 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% + --%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<script type="text/javascript"> + function cancel() { + $('#lostPasswordDialog').dialog('close'); + return false; + } +</script> +<s:form method="POST" namespace="/user"> + <fieldset class="ui-widget-content ui-corner-all"> + + <s:text name="pollen.information.lostPassword"/> + + <div style="padding: 1em; margin-bottom: 3em;"> + <s:textfield key="email" required="true" size="30"/> + </div> + + <hr/> + + <div align="right"> + <s:submit onclick="return cancel();" theme="simple" + key="pollen.action.cancel"/> + <s:submit key="pollen.action.send" theme="simple" + action="lostPassword"/> + </div> + </fieldset> +</s:form> \ No newline at end of file
participants (1)
-
fdesbois@users.chorem.org