This is an automated email from the git hooks/post-receive script. New change to branch develop in repository wao. See http://git.codelutin.com/wao.git from adcd234 [jgitflow-maven-plugin]Updating develop poms back to pre merge state new 6955ed4 refs 6844 Remise en place de la fonctionnalité de demande de réinitialisation de mot de passe new 8d401db Ajout d'une méthode save sur AbstractWaoTopiaDao new 020efa1 Dans le jeu de données de test, on fait en sorte que chaque utilisateur fictif ait un mot de passe (le même pour tout le monde) new 5d86c42 Dans le bundle i18n, on écrit en casse normale, si on veut des majuscules à l'affichage, c'est un question de style, à faire en CSS new c256595 Pas la peine d'afficher deux boutons pour « Mot de passe oublié », pas la peine de l'afficher si la personne a réussi à s'authentifiée (étape de choix du profil ou acceptation CGU) new c23a182 Pas besoin de surcharger input() juste pour appeller super, on définit les @Result en haut de l'action (comme dans le reste de l'appli), aucune raison d'avoir à catcher une NoRoleAttributedException à ce moment new d53a19e Ajout d'un test pour vérifier le bon fonctionnement de la demande de renouvellement de mot de passe new 229ead8 Remaniement de askForPasswordReminder pour réutiliser du code au sein de WaoUsersService new 060144c Ajout d'une valeur i18n manquante new 0afd381 Suppression de code mort (?) new 6ff7c19 refs 6844 En cas de succes du renouvellement de mot de passe, redirection vers page de login. Si mot de passe différent d'email alors redirection vers demande d'intervention sur site new 957035a Refs #6844 : Syntaxical correction new 21521ad Fusion de la branche 'feature/6844-forgotenPassword' dans develop (termine #6844) The 13 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 21521ad790eac9f04852feb30b01f96ba734237d Merge: adcd234 957035a Author: Brendan Le Ny <bleny@codelutin.com> Date: Thu Apr 9 15:18:55 2015 +0200 Fusion de la branche 'feature/6844-forgotenPassword' dans develop (termine #6844) commit 957035a31730ce279226408cbb3ce7165d816998 Author: Léo Kaufmann <kaufmann@codelutin.com> Date: Thu Apr 9 15:07:55 2015 +0200 Refs #6844 : Syntaxical correction commit 6ff7c1974b22686444bcc6dfcfe778a37ac3dc2f Author: dcosse <cosse@codelutin.com> Date: Wed Apr 8 15:04:39 2015 +0200 refs 6844 En cas de succes du renouvellement de mot de passe, redirection vers page de login. Si mot de passe différent d'email alors redirection vers demande d'intervention sur site commit 0afd3815f924c096f60ee24e84241b8be91b2023 Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Mar 31 12:21:30 2015 +0200 Suppression de code mort (?) commit 060144c9eb31e4d10a411585863b57568db81a88 Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Mar 31 12:16:55 2015 +0200 Ajout d'une valeur i18n manquante commit 229ead8e0b9204d01f0cba30584cb612d74649ae Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Mar 31 12:12:53 2015 +0200 Remaniement de askForPasswordReminder pour réutiliser du code au sein de WaoUsersService commit d53a19e3e60fe54d76d42bcab82aeb98e3ce3f35 Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Mar 31 12:12:28 2015 +0200 Ajout d'un test pour vérifier le bon fonctionnement de la demande de renouvellement de mot de passe commit c23a182ef0a557bd07cf207e98021b57323ae354 Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Mar 31 12:12:18 2015 +0200 Pas besoin de surcharger input() juste pour appeller super, on définit les @Result en haut de l'action (comme dans le reste de l'appli), aucune raison d'avoir à catcher une NoRoleAttributedException à ce moment commit c2565950475e8bb627b0b8cc45754a3fd98ebf7b Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Mar 31 12:10:46 2015 +0200 Pas la peine d'afficher deux boutons pour « Mot de passe oublié », pas la peine de l'afficher si la personne a réussi à s'authentifiée (étape de choix du profil ou acceptation CGU) commit 5d86c42a1dad6309100db817b19aa8da49a723c0 Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Mar 31 12:08:41 2015 +0200 Dans le bundle i18n, on écrit en casse normale, si on veut des majuscules à l'affichage, c'est un question de style, à faire en CSS commit 020efa17d198339e52711d6dd41dd2ea2467b290 Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Mar 31 12:08:04 2015 +0200 Dans le jeu de données de test, on fait en sorte que chaque utilisateur fictif ait un mot de passe (le même pour tout le monde) commit 8d401db4c434c1142fefe31bd1e797536ded755e Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Mar 31 12:06:50 2015 +0200 Ajout d'une méthode save sur AbstractWaoTopiaDao commit 6955ed4f77d88c859f4c24d7fa51122413ebec5c Author: dcosse <cosse@codelutin.com> Date: Fri Mar 27 16:35:59 2015 +0100 refs 6844 Remise en place de la fonctionnalité de demande de réinitialisation de mot de passe Summary of changes: .../java/fr/ifremer/wao/AbstractWaoTopiaDao.java | 14 ++-- .../src/main/java/fr/ifremer/wao/WaoUtils.java | 5 ++ .../service/administration/WaoUsersService.java | 94 ++++++++++++++-------- .../email/UserCredentialsEmail_fr.mustache | 2 +- .../wao/services/service/ObsMerFixtures.java | 4 + .../ifremer/wao/services/service/WaoFixtures.java | 9 +++ .../administration/WaoUsersServiceTest.java | 44 ++++++++++ .../java/fr/ifremer/wao/web/WaoInterceptor.java | 5 +- .../authentication/ForgottenPasswordAction.java | 70 ++++++++++++++++ .../main/resources/i18n/wao-web_en_GB.properties | 5 ++ .../main/resources/i18n/wao-web_fr_FR.properties | 5 ++ .../content/authentication/forgotten-password.jsp | 45 +++++++++++ .../WEB-INF/content/authentication/login.jsp | 18 +++-- wao-web/src/main/webapp/WEB-INF/decorators.xml | 1 + 14 files changed, 276 insertions(+), 45 deletions(-) create mode 100644 wao-web/src/main/java/fr/ifremer/wao/web/action/authentication/ForgottenPasswordAction.java create mode 100644 wao-web/src/main/webapp/WEB-INF/content/authentication/forgotten-password.jsp -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit 6955ed4f77d88c859f4c24d7fa51122413ebec5c Author: dcosse <cosse@codelutin.com> Date: Fri Mar 27 16:35:59 2015 +0100 refs 6844 Remise en place de la fonctionnalité de demande de réinitialisation de mot de passe --- .../service/administration/WaoUsersService.java | 37 +++++++++++ .../java/fr/ifremer/wao/web/WaoInterceptor.java | 5 +- .../authentication/ForgottenPasswordAction.java | 71 ++++++++++++++++++++++ .../main/resources/i18n/wao-web_en_GB.properties | 3 + .../main/resources/i18n/wao-web_fr_FR.properties | 3 + .../content/authentication/forgotten-password.jsp | 48 +++++++++++++++ .../WEB-INF/content/authentication/login.jsp | 22 ++++++- wao-web/src/main/webapp/WEB-INF/decorators.xml | 1 + 8 files changed, 187 insertions(+), 3 deletions(-) diff --git a/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/WaoUsersService.java b/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/WaoUsersService.java index 6bead99..2e31b91 100644 --- a/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/WaoUsersService.java +++ b/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/WaoUsersService.java @@ -291,4 +291,41 @@ public class WaoUsersService extends WaoServiceSupport { commit(); } + + protected UpdateWaoUserCommand getPasswordRecoveryUpdateWaoUserCommand(WaoUser waoUser) { + UpdateWaoUserCommand updateWaoUserCommand = new UpdateWaoUserCommand(); + updateWaoUserCommand.setWaoUser(waoUser); + updateWaoUserCommand.setPasswordStrategy(UpdateWaoUserCommandPasswordStrategy.GENERATE_NEW_PASSWORD); + updateWaoUserCommand.setPasswordStrategies(UpdateWaoUserCommandPasswordStrategy.getPasswordStrategiesForWaoUserCreation()); + return updateWaoUserCommand; + } + + public void askForPasswordReminder(String login) throws WrongCredentialsException, InactiveWaoUserException, NoRoleAttributedException { + WaoUserTopiaDao dao = getWaoUserDao(); + + Optional<WaoUser> optionalWaoUser = dao.tryFindByEmailAndFetchCollections(login); + + WaoUser waoUser; + + if ( ! optionalWaoUser.isPresent()) { + if (log.isInfoEnabled()) { + log.info("no such user " + login); + } + throw new WrongCredentialsException(); + } + + waoUser = optionalWaoUser.get(); + + if ( ! waoUser.isActive()) { + throw new InactiveWaoUserException(waoUser); + } + + if (waoUser.isUserProfileEmpty()) { + throw new NoRoleAttributedException(waoUser); + } + + UpdateWaoUserCommand updateWaoUserCommand = getPasswordRecoveryUpdateWaoUserCommand(waoUser); + + save(updateWaoUserCommand); + } } diff --git a/wao-web/src/main/java/fr/ifremer/wao/web/WaoInterceptor.java b/wao-web/src/main/java/fr/ifremer/wao/web/WaoInterceptor.java index 448c87e..a36cc45 100644 --- a/wao-web/src/main/java/fr/ifremer/wao/web/WaoInterceptor.java +++ b/wao-web/src/main/java/fr/ifremer/wao/web/WaoInterceptor.java @@ -30,6 +30,7 @@ import fr.ifremer.wao.WaoTopiaPersistenceContext; import fr.ifremer.wao.services.WaoApplicationContext; import fr.ifremer.wao.services.WaoService; import fr.ifremer.wao.services.WaoServiceContext; +import fr.ifremer.wao.web.action.authentication.ForgottenPasswordAction; import fr.ifremer.wao.web.action.authentication.LoginAction; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.logging.Log; @@ -44,8 +45,8 @@ public class WaoInterceptor implements Interceptor { private static final Log log = LogFactory.getLog(WaoInterceptor.class); - protected static final ImmutableSet<Class<LoginAction>> ACTIONS_ACCESSIBLE_WITHOUT_LOGIN = - ImmutableSet.of(LoginAction.class); + protected static final ImmutableSet<Class<? extends WaoJspActionSupport>> ACTIONS_ACCESSIBLE_WITHOUT_LOGIN = + ImmutableSet.of(LoginAction.class, ForgottenPasswordAction.class); @Override public void init() { diff --git a/wao-web/src/main/java/fr/ifremer/wao/web/action/authentication/ForgottenPasswordAction.java b/wao-web/src/main/java/fr/ifremer/wao/web/action/authentication/ForgottenPasswordAction.java new file mode 100644 index 0000000..e3cb2ec --- /dev/null +++ b/wao-web/src/main/java/fr/ifremer/wao/web/action/authentication/ForgottenPasswordAction.java @@ -0,0 +1,71 @@ +package fr.ifremer.wao.web.action.authentication; + +import fr.ifremer.wao.services.service.administration.InactiveWaoUserException; +import fr.ifremer.wao.services.service.administration.NoRoleAttributedException; +import fr.ifremer.wao.services.service.administration.WaoUsersService; +import fr.ifremer.wao.services.service.administration.WrongCredentialsException; +import fr.ifremer.wao.web.WaoJspActionSupport; +import org.apache.struts2.convention.annotation.Action; +import org.apache.struts2.convention.annotation.Result; + +/** + * Created by davidcosse on 26/03/15. + */ +public class ForgottenPasswordAction extends WaoJspActionSupport { + + private static final long serialVersionUID = 1L; + + protected transient WaoUsersService service; + + protected String login; + + protected boolean recovered; + + public void setService(WaoUsersService service) { + this.service = service; + } + + @Override + @Action("forgotten-password-input") + public String input() throws Exception { + return super.input(); + } + + @Override + @Action(results = { + @Result(name="success", type="redirectAction", params = { "namespace", "/authentication", "actionName", "forgotten-password!input", "recovered", "%{recovered}", "login", "%{login}"})}) + public String execute() throws Exception { + try { + service.askForPasswordReminder(login); + recovered = true; + addActionMessage(t("wao.ui.reminderSent")); + } catch (WrongCredentialsException credentialException) { + addFieldError("login", t("wao.ui.form.authentication.error.wrongCredentials")); + return INPUT; + } catch (InactiveWaoUserException inactiveWaoUserException) { + addFieldError("login", t("wao.ui.form.authentication.error.noRoleAttributed")); + return INPUT; + } catch (NoRoleAttributedException noRoleAttributedException) { + addFieldError("login", t("wao.ui.form.authentication.error.inactiveWaoUser")); + return INPUT; + } + + return SUCCESS; + } + + public void setLogin(String login) { + this.login = login; + } + + public String getLogin() { + return login; + } + + public boolean isRecovered() { + return recovered; + } + + public void setRecovered(boolean recovered) { + this.recovered = recovered; + } +} diff --git a/wao-web/src/main/resources/i18n/wao-web_en_GB.properties b/wao-web/src/main/resources/i18n/wao-web_en_GB.properties index 98da054..303aee2 100644 --- a/wao-web/src/main/resources/i18n/wao-web_en_GB.properties +++ b/wao-web/src/main/resources/i18n/wao-web_en_GB.properties @@ -378,6 +378,8 @@ wao.ui.form.authentication.error.inactiveWaoUser=This wao user is not active. Pl wao.ui.form.authentication.error.noRoleAttributed=This wao user has no role affected. Please, contact an administrator wao.ui.form.authentication.error.userMustAcceptCgu=You must accept the end-user agreement wao.ui.form.authentication.error.wrongCredentials=Incorrect credentials +wao.ui.form.authentication.forgottenPassword.recoverButton=RESET PASSWORD +wao.ui.form.authentication.forgottenPassword.title=Reset your WAO's password wao.ui.form.authentication.title=WAO authentication wao.ui.form.boardingFrom=Boardings since wao.ui.form.boatName.placeholder=Name of boat @@ -530,6 +532,7 @@ wao.ui.page.waoUsers.titleForCompany=Users for company %s wao.ui.periodToMustBeAfterPeriodFrom=The end of the period must be after the beginning wao.ui.publishedByProgram=Pusblished by program wao.ui.publishedByYourCompany=Published by company +wao.ui.reminderSent= wao.ui.removeBoatEligibility.confirm=Are you sure you want to make this boat ineligible for sample row ? wao.ui.sampleRow.creation=Creation of a sample row wao.ui.sampleRow.edition=Edition of line %s diff --git a/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties b/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties index 00b2b0d..68f026d 100644 --- a/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties +++ b/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties @@ -379,6 +379,8 @@ wao.ui.form.authentication.error.inactiveWaoUser=Ce compte est inactif, veuillez wao.ui.form.authentication.error.noRoleAttributed=Aucun rôle n'est attribué à ce compte, veuillez contacter un responsable wao.ui.form.authentication.error.userMustAcceptCgu=Vous devez accepter les conditions générales d'utilisation wao.ui.form.authentication.error.wrongCredentials=Les informations d'authenfication ne sont pas correctes +wao.ui.form.authentication.forgottenPassword.recoverButton=RÉINITIALISER +wao.ui.form.authentication.forgottenPassword.title=Récupération de votre mot de passe WAO wao.ui.form.authentication.title=Identification WAO wao.ui.form.boardingFrom=Sollicitations du navire depuis le wao.ui.form.boatName.placeholder=Nom du bateau @@ -531,6 +533,7 @@ wao.ui.page.waoUsers.titleForCompany=Utilisateurs de la société %s wao.ui.periodToMustBeAfterPeriodFrom=La période de temps doit se terminer après avoir commencé wao.ui.publishedByProgram=Publiée par le programme wao.ui.publishedByYourCompany=Publiée par la société +wao.ui.reminderSent=Email de récupération du mot de passe envoyé, consultez votre boîte mail wao.ui.removeBoatEligibility.confirm=Êtes-vous sûr de vouloir rendre le navire inéligible pour cette ligne ? wao.ui.sampleRow.creation=Création d'une ligne du plan d'échantillonnage wao.ui.sampleRow.edition=Modification de la ligne %s diff --git a/wao-web/src/main/webapp/WEB-INF/content/authentication/forgotten-password.jsp b/wao-web/src/main/webapp/WEB-INF/content/authentication/forgotten-password.jsp new file mode 100644 index 0000000..8fa421e --- /dev/null +++ b/wao-web/src/main/webapp/WEB-INF/content/authentication/forgotten-password.jsp @@ -0,0 +1,48 @@ +<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> +<%@taglib prefix="s" uri="/struts-tags" %> +<%@taglib prefix="sj" uri="/struts-jquery-tags" %> + +<html> + <head> + <title> + <s:text name="wao.ui.form.authentication.forgottenPassword.title" /> + </title> + </head> + <body> + + <h1> + <s:text name="wao.ui.form.authentication.forgottenPassword.title" /> + </h1> + + <s:form action="forgotten-password" namespace="/authentication" method="POST" cssClass="form-horizontal"> + + <fieldset> + <s:if test="recovered"> + <s:text name="wao.ui.reminderSent"/> + </s:if> + <s:else> + <s:textfield name="login" + label="%{getText('wao.ui.field.WaoUser.login')}"/> + </s:else> + </fieldset> + + <div class="form-actions"> + <s:if test="recovered"> + <s:url namespace="/authentication" action="login!input" id="loginUrl"> + <s:param name="login" value="login" /> + </s:url> + <s:a href="%{loginUrl}" cssClass="btn"> + <s:text name="wao.ui.form.authentication.action.submit"/> + </s:a> + </s:if> + <s:else> + <s:submit type="button" cssClass="btn btn-primary"> + <s:text name="wao.ui.form.authentication.forgottenPassword.recoverButton"/> + </s:submit> + </s:else> + </div> + + </s:form> + + </body> +</html> diff --git a/wao-web/src/main/webapp/WEB-INF/content/authentication/login.jsp b/wao-web/src/main/webapp/WEB-INF/content/authentication/login.jsp index 2e13d0a..41382b4 100644 --- a/wao-web/src/main/webapp/WEB-INF/content/authentication/login.jsp +++ b/wao-web/src/main/webapp/WEB-INF/content/authentication/login.jsp @@ -19,7 +19,7 @@ #L% --%> <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> -<%@taglib prefix="s" uri="/struts-tags" %> +<%@taglib prefix="s" uri="/struts-tags" %> <%@taglib prefix="sj" uri="/struts-jquery-tags" %> <html> @@ -32,6 +32,11 @@ $('input[name="login"]').focus(); }); </script> + <script type="text/javascript"> + function getLogin() { + return login = $('input[name="login"]').val(); + } + </script> </head> <body> @@ -60,6 +65,14 @@ </s:else> + <s:if test="credentialsAsked"> + <s:url namespace="/authentication" action="forgotten-password" id="recoverPasswordURL"> + </s:url> + <s:a href="%{recoverPasswordURL}"> + <s:text name="wao.ui.forgotPassword"/> + </s:a> + </s:if> + <s:if test="userProfileAsked"> <s:radio name="userProfileId" list="userProfiles" label="%{getText('wao.ui.form.authentication.chooseUserProfile')}" /> @@ -75,6 +88,13 @@ </fieldset> <div class="form-actions"> + <s:if test="credentialsAsked"> + <s:submit type="button" cssClass="btn btn-primary"> + <s:param name="userPassordReminderAsked">true</s:param> + <s:text name="wao.ui.forgotPassword"/> + </s:submit> + </s:if> + <s:submit type="button" cssClass="btn btn-primary"> <s:text name="wao.ui.form.authentication.action.submit"/> </s:submit> diff --git a/wao-web/src/main/webapp/WEB-INF/decorators.xml b/wao-web/src/main/webapp/WEB-INF/decorators.xml index 774ea9f..a6bce8d 100644 --- a/wao-web/src/main/webapp/WEB-INF/decorators.xml +++ b/wao-web/src/main/webapp/WEB-INF/decorators.xml @@ -28,6 +28,7 @@ <decorator name="layout-login" page="layout-login.jsp"> <pattern>/authentication/login*</pattern> + <pattern>/authentication/forgotten-password*</pattern> </decorator> <decorator name="layout" page="layout.jsp"> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit 8d401db4c434c1142fefe31bd1e797536ded755e Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Mar 31 12:06:50 2015 +0200 Ajout d'une méthode save sur AbstractWaoTopiaDao --- .../src/main/java/fr/ifremer/wao/AbstractWaoTopiaDao.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/wao-persistence/src/main/java/fr/ifremer/wao/AbstractWaoTopiaDao.java b/wao-persistence/src/main/java/fr/ifremer/wao/AbstractWaoTopiaDao.java index 67103d7..c587fad 100644 --- a/wao-persistence/src/main/java/fr/ifremer/wao/AbstractWaoTopiaDao.java +++ b/wao-persistence/src/main/java/fr/ifremer/wao/AbstractWaoTopiaDao.java @@ -31,11 +31,15 @@ public abstract class AbstractWaoTopiaDao<E extends TopiaEntity> extends Abstrac public void saveNullable(E entity) { if (entity != null) { - if (entity.isPersisted()) { - update(entity); - } else { - create(entity); - } + save(entity); + } + } + + public void save(E entity) { + if (entity.isPersisted()) { + update(entity); + } else { + create(entity); } } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit 020efa17d198339e52711d6dd41dd2ea2467b290 Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Mar 31 12:08:04 2015 +0200 Dans le jeu de données de test, on fait en sorte que chaque utilisateur fictif ait un mot de passe (le même pour tout le monde) --- .../java/fr/ifremer/wao/services/service/ObsMerFixtures.java | 4 ++++ .../test/java/fr/ifremer/wao/services/service/WaoFixtures.java | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/wao-services/src/test/java/fr/ifremer/wao/services/service/ObsMerFixtures.java b/wao-services/src/test/java/fr/ifremer/wao/services/service/ObsMerFixtures.java index fa8a3bf..ed39904 100644 --- a/wao-services/src/test/java/fr/ifremer/wao/services/service/ObsMerFixtures.java +++ b/wao-services/src/test/java/fr/ifremer/wao/services/service/ObsMerFixtures.java @@ -48,6 +48,10 @@ public class ObsMerFixtures extends WaoFixtures { return newAuthenticatedWaoUser("jmichmuche", ObsProgram.OBSMER, UserRole.COORDINATOR, ifremer()); } + public AuthenticatedWaoUser robert() { + return newAuthenticatedWaoUser("robert@codelutin.com", ObsProgram.OBSMER, UserRole.COORDINATOR, ifremer()); + } + public void samplingPlan() { ifremer(); oceanet(); diff --git a/wao-services/src/test/java/fr/ifremer/wao/services/service/WaoFixtures.java b/wao-services/src/test/java/fr/ifremer/wao/services/service/WaoFixtures.java index 1235c60..61bc1e3 100644 --- a/wao-services/src/test/java/fr/ifremer/wao/services/service/WaoFixtures.java +++ b/wao-services/src/test/java/fr/ifremer/wao/services/service/WaoFixtures.java @@ -23,6 +23,7 @@ package fr.ifremer.wao.services.service; import com.google.common.collect.Iterables; import fr.ifremer.wao.WaoTechnicalException; +import fr.ifremer.wao.WaoUtils; import fr.ifremer.wao.entity.Company; import fr.ifremer.wao.entity.CompanyTopiaDao; import fr.ifremer.wao.entity.Laboratory; @@ -91,6 +92,7 @@ public class WaoFixtures { waoUser = new WaoUserImpl(); waoUser.setOrganisation(organisation); waoUser.setLogin(login); + waoUser.setPassword(WaoUtils.hashPassword(fakePassword())); waoUser.setFirstName("Prénom de " + login); waoUser.setLastName("Nom de " + login); waoUser.setActive(true); @@ -105,6 +107,13 @@ public class WaoFixtures { return new AuthenticatedWaoUser(waoUser, Iterables.getOnlyElement(waoUser.getUserProfile())); } + /** + * @return le mot de passe de tous les utilisateurs des fixtures + */ + public String fakePassword() { + return "fakePassword"; + } + public Company ifremer() { return getCompany("IFREMER", true); } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit 5d86c42a1dad6309100db817b19aa8da49a723c0 Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Mar 31 12:08:41 2015 +0200 Dans le bundle i18n, on écrit en casse normale, si on veut des majuscules à l'affichage, c'est un question de style, à faire en CSS --- wao-web/src/main/resources/i18n/wao-web_en_GB.properties | 2 +- wao-web/src/main/resources/i18n/wao-web_fr_FR.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wao-web/src/main/resources/i18n/wao-web_en_GB.properties b/wao-web/src/main/resources/i18n/wao-web_en_GB.properties index 303aee2..53cd06c 100644 --- a/wao-web/src/main/resources/i18n/wao-web_en_GB.properties +++ b/wao-web/src/main/resources/i18n/wao-web_en_GB.properties @@ -378,7 +378,7 @@ wao.ui.form.authentication.error.inactiveWaoUser=This wao user is not active. Pl wao.ui.form.authentication.error.noRoleAttributed=This wao user has no role affected. Please, contact an administrator wao.ui.form.authentication.error.userMustAcceptCgu=You must accept the end-user agreement wao.ui.form.authentication.error.wrongCredentials=Incorrect credentials -wao.ui.form.authentication.forgottenPassword.recoverButton=RESET PASSWORD +wao.ui.form.authentication.forgottenPassword.recoverButton=Reset password wao.ui.form.authentication.forgottenPassword.title=Reset your WAO's password wao.ui.form.authentication.title=WAO authentication wao.ui.form.boardingFrom=Boardings since diff --git a/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties b/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties index 68f026d..18434ae 100644 --- a/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties +++ b/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties @@ -379,7 +379,7 @@ wao.ui.form.authentication.error.inactiveWaoUser=Ce compte est inactif, veuillez wao.ui.form.authentication.error.noRoleAttributed=Aucun rôle n'est attribué à ce compte, veuillez contacter un responsable wao.ui.form.authentication.error.userMustAcceptCgu=Vous devez accepter les conditions générales d'utilisation wao.ui.form.authentication.error.wrongCredentials=Les informations d'authenfication ne sont pas correctes -wao.ui.form.authentication.forgottenPassword.recoverButton=RÉINITIALISER +wao.ui.form.authentication.forgottenPassword.recoverButton=Demander un nouveau mot de passe wao.ui.form.authentication.forgottenPassword.title=Récupération de votre mot de passe WAO wao.ui.form.authentication.title=Identification WAO wao.ui.form.boardingFrom=Sollicitations du navire depuis le -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit c2565950475e8bb627b0b8cc45754a3fd98ebf7b Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Mar 31 12:10:46 2015 +0200 Pas la peine d'afficher deux boutons pour « Mot de passe oublié », pas la peine de l'afficher si la personne a réussi à s'authentifiée (étape de choix du profil ou acceptation CGU) --- .../WEB-INF/content/authentication/login.jsp | 31 +++++++++------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/wao-web/src/main/webapp/WEB-INF/content/authentication/login.jsp b/wao-web/src/main/webapp/WEB-INF/content/authentication/login.jsp index 41382b4..3aeb73b 100644 --- a/wao-web/src/main/webapp/WEB-INF/content/authentication/login.jsp +++ b/wao-web/src/main/webapp/WEB-INF/content/authentication/login.jsp @@ -65,14 +65,6 @@ </s:else> - <s:if test="credentialsAsked"> - <s:url namespace="/authentication" action="forgotten-password" id="recoverPasswordURL"> - </s:url> - <s:a href="%{recoverPasswordURL}"> - <s:text name="wao.ui.forgotPassword"/> - </s:a> - </s:if> - <s:if test="userProfileAsked"> <s:radio name="userProfileId" list="userProfiles" label="%{getText('wao.ui.form.authentication.chooseUserProfile')}" /> @@ -88,21 +80,22 @@ </fieldset> <div class="form-actions"> - <s:if test="credentialsAsked"> - <s:submit type="button" cssClass="btn btn-primary"> - <s:param name="userPassordReminderAsked">true</s:param> - <s:text name="wao.ui.forgotPassword"/> - </s:submit> - </s:if> - <s:submit type="button" cssClass="btn btn-primary"> <s:text name="wao.ui.form.authentication.action.submit"/> </s:submit> - <s:url namespace="/authentication" action="login!input" id="cancelUrl"/> - <s:a href="%{cancelUrl}" cssClass="btn"> - <s:text name="wao.ui.action.cancel"/> - </s:a> + <s:if test="userProfileAsked || acceptCguAsked"> + <s:url namespace="/authentication" action="login!input" id="cancelUrl"/> + <s:a href="%{cancelUrl}" cssClass="btn"> + <s:text name="wao.ui.action.cancel"/> + </s:a> + </s:if> + <s:else> + <s:url namespace="/authentication" action="forgotten-password!input" id="recoverPasswordUrl" /> + <s:a href="%{recoverPasswordUrl}" cssClass="btn btn-link"> + <s:text name="wao.ui.forgotPassword"/> + </s:a> + </s:else> </div> </s:form> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit c23a182ef0a557bd07cf207e98021b57323ae354 Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Mar 31 12:12:18 2015 +0200 Pas besoin de surcharger input() juste pour appeller super, on définit les @Result en haut de l'action (comme dans le reste de l'appli), aucune raison d'avoir à catcher une NoRoleAttributedException à ce moment --- .../authentication/ForgottenPasswordAction.java | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/wao-web/src/main/java/fr/ifremer/wao/web/action/authentication/ForgottenPasswordAction.java b/wao-web/src/main/java/fr/ifremer/wao/web/action/authentication/ForgottenPasswordAction.java index e3cb2ec..ce49700 100644 --- a/wao-web/src/main/java/fr/ifremer/wao/web/action/authentication/ForgottenPasswordAction.java +++ b/wao-web/src/main/java/fr/ifremer/wao/web/action/authentication/ForgottenPasswordAction.java @@ -1,16 +1,18 @@ package fr.ifremer.wao.web.action.authentication; import fr.ifremer.wao.services.service.administration.InactiveWaoUserException; -import fr.ifremer.wao.services.service.administration.NoRoleAttributedException; import fr.ifremer.wao.services.service.administration.WaoUsersService; import fr.ifremer.wao.services.service.administration.WrongCredentialsException; import fr.ifremer.wao.web.WaoJspActionSupport; -import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Result; +import org.apache.struts2.convention.annotation.Results; /** - * Created by davidcosse on 26/03/15. + * @since 5.1.2 */ +@Results({ + @Result(name="success", type="redirectAction", params = { "namespace", "/authentication", "actionName", "forgotten-password!input", "recovered", "%{recovered}", "login", "%{login}"}) +}) public class ForgottenPasswordAction extends WaoJspActionSupport { private static final long serialVersionUID = 1L; @@ -26,15 +28,8 @@ public class ForgottenPasswordAction extends WaoJspActionSupport { } @Override - @Action("forgotten-password-input") - public String input() throws Exception { - return super.input(); - } + public String execute() { - @Override - @Action(results = { - @Result(name="success", type="redirectAction", params = { "namespace", "/authentication", "actionName", "forgotten-password!input", "recovered", "%{recovered}", "login", "%{login}"})}) - public String execute() throws Exception { try { service.askForPasswordReminder(login); recovered = true; @@ -43,9 +38,6 @@ public class ForgottenPasswordAction extends WaoJspActionSupport { addFieldError("login", t("wao.ui.form.authentication.error.wrongCredentials")); return INPUT; } catch (InactiveWaoUserException inactiveWaoUserException) { - addFieldError("login", t("wao.ui.form.authentication.error.noRoleAttributed")); - return INPUT; - } catch (NoRoleAttributedException noRoleAttributedException) { addFieldError("login", t("wao.ui.form.authentication.error.inactiveWaoUser")); return INPUT; } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit d53a19e3e60fe54d76d42bcab82aeb98e3ce3f35 Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Mar 31 12:12:28 2015 +0200 Ajout d'un test pour vérifier le bon fonctionnement de la demande de renouvellement de mot de passe --- .../administration/WaoUsersServiceTest.java | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/wao-services/src/test/java/fr/ifremer/wao/services/service/administration/WaoUsersServiceTest.java b/wao-services/src/test/java/fr/ifremer/wao/services/service/administration/WaoUsersServiceTest.java index e47d44d..6653feb 100644 --- a/wao-services/src/test/java/fr/ifremer/wao/services/service/administration/WaoUsersServiceTest.java +++ b/wao-services/src/test/java/fr/ifremer/wao/services/service/administration/WaoUsersServiceTest.java @@ -22,8 +22,10 @@ package fr.ifremer.wao.services.service.administration; */ import fr.ifremer.wao.services.AbstractWaoServiceTest; +import fr.ifremer.wao.services.service.ObsMerFixtures; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -33,11 +35,19 @@ public class WaoUsersServiceTest extends AbstractWaoServiceTest { protected WaoUsersService service; + protected ObsMerFixtures fixtures; + + protected boolean isDatabaseWithReferential() { + return true; + } + @Before public void setUp() { service = newService(WaoUsersService.class); + fixtures = new ObsMerFixtures(newServiceContext()); + } @Test @@ -50,4 +60,38 @@ public class WaoUsersServiceTest extends AbstractWaoServiceTest { } } + + @Test + public void testAskForNewPassword() throws WrongCredentialsException, NoRoleAttributedException, InactiveWaoUserException { + + String login = fixtures.robert().getWaoUser().getLogin(); + String fakePassword = fixtures.fakePassword(); + + service.authenticate(login, fakePassword); + + try { + service.askForPasswordReminder(login); + service.authenticate(login, "BJlNoN1Q"); + } catch (WrongCredentialsException | InactiveWaoUserException | NoRoleAttributedException e) { + if (log.isDebugEnabled()) { + log.debug("unexpected exception", e); + } + Assert.fail("unexpected exception" + e); + } + + try { + service.authenticate(login, fakePassword); + Assert.fail("expected exception"); + } catch (WrongCredentialsException e) { + if (log.isDebugEnabled()) { + log.debug("expected exception", e); + } + } catch (NoRoleAttributedException | InactiveWaoUserException e) { + if (log.isDebugEnabled()) { + log.debug("unexpected exception", e); + } + Assert.fail("unexpected exception" + e); + } + + } } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit 229ead8e0b9204d01f0cba30584cb612d74649ae Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Mar 31 12:12:53 2015 +0200 Remaniement de askForPasswordReminder pour réutiliser du code au sein de WaoUsersService --- .../src/main/java/fr/ifremer/wao/WaoUtils.java | 5 + .../service/administration/WaoUsersService.java | 109 ++++++++++----------- 2 files changed, 56 insertions(+), 58 deletions(-) diff --git a/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java b/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java index 8f07aaf..0f4814e 100644 --- a/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java +++ b/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java @@ -29,6 +29,7 @@ import org.apache.commons.lang3.mutable.MutableInt; import org.apache.commons.lang3.time.DateUtils; import org.nuiton.i18n.I18n; import org.nuiton.util.DateUtil; +import org.nuiton.util.StringUtil; import java.text.DateFormat; import java.text.ParseException; @@ -291,4 +292,8 @@ public class WaoUtils { } return keyWithHighestValue; } + + public static String hashPassword(String password) { + return StringUtil.encodeMD5(password); + } } diff --git a/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/WaoUsersService.java b/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/WaoUsersService.java index 2e31b91..c9bea58 100644 --- a/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/WaoUsersService.java +++ b/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/WaoUsersService.java @@ -25,6 +25,7 @@ import com.google.common.base.Optional; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.google.common.collect.Maps; +import fr.ifremer.wao.WaoUtils; import fr.ifremer.wao.entity.Boat; import fr.ifremer.wao.entity.Boats; import fr.ifremer.wao.entity.ObsProgram; @@ -44,7 +45,6 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.topia.persistence.TopiaEntities; import org.nuiton.topia.persistence.TopiaEntity; import org.nuiton.topia.persistence.TopiaQueryBuilderAddCriteriaOrRunQueryStep; -import org.nuiton.util.StringUtil; import java.util.HashSet; import java.util.List; @@ -183,17 +183,13 @@ public class WaoUsersService extends WaoServiceSupport { } if (newPassword != null) { - String hashedNewPassword = StringUtil.encodeMD5(newPassword); + + String hashedNewPassword = WaoUtils.hashPassword(newPassword); waoUser.setPassword(hashedNewPassword); } if (updateWaoUserCommand.getPasswordStrategy().isGeneratePassword()) { - UserCredentialsEmail userCredentialsEmail = - getEmailService().newUserCredentialsEmail(); - userCredentialsEmail.addTo(waoUser); - userCredentialsEmail.setWaoUser(waoUser); - userCredentialsEmail.setNewPassword(newPassword); - getEmailService().send(userCredentialsEmail); + sendNewPasswordToUser(waoUser, newPassword); } if (waoUser.isUserProfileNotEmpty()) { @@ -204,19 +200,26 @@ public class WaoUsersService extends WaoServiceSupport { } } - WaoUserTopiaDao dao = getWaoUserDao(); - if (waoUser.isPersisted()) { - dao.update(waoUser); - } else { - dao.create(waoUser); - } + getWaoUserDao().save(waoUser); commit(); } + protected void sendNewPasswordToUser(WaoUser waoUser, String newPassword) { + + UserCredentialsEmail userCredentialsEmail = + getEmailService().newUserCredentialsEmail(); + userCredentialsEmail.addTo(waoUser); + userCredentialsEmail.setWaoUser(waoUser); + userCredentialsEmail.setNewPassword(newPassword); + + getEmailService().send(userCredentialsEmail); + + } + protected String newRandomPassword() { - return RandomStringUtils.random(8, true, true); + return RandomStringUtils.random(8, 0, 0, true, true, null, serviceContext.getRandom()); } @@ -249,21 +252,9 @@ public class WaoUsersService extends WaoServiceSupport { public WaoUser authenticate(String login, String clearPassword) throws WrongCredentialsException, NoRoleAttributedException, InactiveWaoUserException { - WaoUserTopiaDao dao = getWaoUserDao(); - - Optional<WaoUser> optionalWaoUser = dao.tryFindByEmailAndFetchCollections(login); - - WaoUser waoUser; - - if ( ! optionalWaoUser.isPresent()) { - if (log.isInfoEnabled()) { - log.info("no such user " + login); - } - throw new WrongCredentialsException(); - } + WaoUser waoUser = findWaoUserByLogin(login, true); - waoUser = optionalWaoUser.get(); - String hashedPassword = StringUtil.encodeMD5(clearPassword); + String hashedPassword = WaoUtils.hashPassword(clearPassword); if ( ! waoUser.getPassword().equals(hashedPassword)) { if (log.isWarnEnabled()) { @@ -272,10 +263,6 @@ public class WaoUsersService extends WaoServiceSupport { throw new WrongCredentialsException(); } - if ( ! waoUser.isActive()) { - throw new InactiveWaoUserException(waoUser); - } - if (waoUser.isUserProfileEmpty()) { throw new NoRoleAttributedException(waoUser); } @@ -284,28 +271,16 @@ public class WaoUsersService extends WaoServiceSupport { } - public void acceptCgu(WaoUser waoUser) { - - waoUser.setCguAccepted(serviceContext.getNow()); - - commit(); - - } - - protected UpdateWaoUserCommand getPasswordRecoveryUpdateWaoUserCommand(WaoUser waoUser) { - UpdateWaoUserCommand updateWaoUserCommand = new UpdateWaoUserCommand(); - updateWaoUserCommand.setWaoUser(waoUser); - updateWaoUserCommand.setPasswordStrategy(UpdateWaoUserCommandPasswordStrategy.GENERATE_NEW_PASSWORD); - updateWaoUserCommand.setPasswordStrategies(UpdateWaoUserCommandPasswordStrategy.getPasswordStrategiesForWaoUserCreation()); - return updateWaoUserCommand; - } + protected WaoUser findWaoUserByLogin(String login, boolean fetchDataForSession) throws WrongCredentialsException, InactiveWaoUserException { - public void askForPasswordReminder(String login) throws WrongCredentialsException, InactiveWaoUserException, NoRoleAttributedException { WaoUserTopiaDao dao = getWaoUserDao(); - Optional<WaoUser> optionalWaoUser = dao.tryFindByEmailAndFetchCollections(login); - - WaoUser waoUser; + Optional<WaoUser> optionalWaoUser; + if (fetchDataForSession) { + optionalWaoUser = dao.tryFindByEmailAndFetchCollections(login); + } else { + optionalWaoUser = dao.forLoginEquals(login).tryFindUnique(); + } if ( ! optionalWaoUser.isPresent()) { if (log.isInfoEnabled()) { @@ -314,18 +289,36 @@ public class WaoUsersService extends WaoServiceSupport { throw new WrongCredentialsException(); } - waoUser = optionalWaoUser.get(); + WaoUser waoUser = optionalWaoUser.get(); if ( ! waoUser.isActive()) { throw new InactiveWaoUserException(waoUser); } - if (waoUser.isUserProfileEmpty()) { - throw new NoRoleAttributedException(waoUser); - } + return waoUser; + } - UpdateWaoUserCommand updateWaoUserCommand = getPasswordRecoveryUpdateWaoUserCommand(waoUser); + public void acceptCgu(WaoUser waoUser) { + + waoUser.setCguAccepted(serviceContext.getNow()); + + commit(); + + } + + public void askForPasswordReminder(String login) throws WrongCredentialsException, InactiveWaoUserException { + + WaoUser waoUser = findWaoUserByLogin(login, false); + + String newPassword = newRandomPassword(); + String hashedNewPassword = WaoUtils.hashPassword(newPassword); + waoUser.setPassword(hashedNewPassword); + + sendNewPasswordToUser(waoUser, newPassword); + + getWaoUserDao().save(waoUser); + commit(); - save(updateWaoUserCommand); } + } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit 060144c9eb31e4d10a411585863b57568db81a88 Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Mar 31 12:16:55 2015 +0200 Ajout d'une valeur i18n manquante --- wao-web/src/main/resources/i18n/wao-web_en_GB.properties | 2 +- wao-web/src/main/resources/i18n/wao-web_fr_FR.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wao-web/src/main/resources/i18n/wao-web_en_GB.properties b/wao-web/src/main/resources/i18n/wao-web_en_GB.properties index 53cd06c..1ed6cc8 100644 --- a/wao-web/src/main/resources/i18n/wao-web_en_GB.properties +++ b/wao-web/src/main/resources/i18n/wao-web_en_GB.properties @@ -532,7 +532,7 @@ wao.ui.page.waoUsers.titleForCompany=Users for company %s wao.ui.periodToMustBeAfterPeriodFrom=The end of the period must be after the beginning wao.ui.publishedByProgram=Pusblished by program wao.ui.publishedByYourCompany=Published by company -wao.ui.reminderSent= +wao.ui.reminderSent=A new password has been sent, check out you inbox. wao.ui.removeBoatEligibility.confirm=Are you sure you want to make this boat ineligible for sample row ? wao.ui.sampleRow.creation=Creation of a sample row wao.ui.sampleRow.edition=Edition of line %s diff --git a/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties b/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties index 18434ae..f0bba41 100644 --- a/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties +++ b/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties @@ -533,7 +533,7 @@ wao.ui.page.waoUsers.titleForCompany=Utilisateurs de la société %s wao.ui.periodToMustBeAfterPeriodFrom=La période de temps doit se terminer après avoir commencé wao.ui.publishedByProgram=Publiée par le programme wao.ui.publishedByYourCompany=Publiée par la société -wao.ui.reminderSent=Email de récupération du mot de passe envoyé, consultez votre boîte mail +wao.ui.reminderSent=Email de récupération du mot de passe envoyé, consultez votre boîte mail. wao.ui.removeBoatEligibility.confirm=Êtes-vous sûr de vouloir rendre le navire inéligible pour cette ligne ? wao.ui.sampleRow.creation=Création d'une ligne du plan d'échantillonnage wao.ui.sampleRow.edition=Modification de la ligne %s -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit 0afd3815f924c096f60ee24e84241b8be91b2023 Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Mar 31 12:21:30 2015 +0200 Suppression de code mort (?) --- wao-web/src/main/webapp/WEB-INF/content/authentication/login.jsp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/wao-web/src/main/webapp/WEB-INF/content/authentication/login.jsp b/wao-web/src/main/webapp/WEB-INF/content/authentication/login.jsp index 3aeb73b..8a39c9e 100644 --- a/wao-web/src/main/webapp/WEB-INF/content/authentication/login.jsp +++ b/wao-web/src/main/webapp/WEB-INF/content/authentication/login.jsp @@ -32,11 +32,6 @@ $('input[name="login"]').focus(); }); </script> - <script type="text/javascript"> - function getLogin() { - return login = $('input[name="login"]').val(); - } - </script> </head> <body> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit 6ff7c1974b22686444bcc6dfcfe778a37ac3dc2f Author: dcosse <cosse@codelutin.com> Date: Wed Apr 8 15:04:39 2015 +0200 refs 6844 En cas de succes du renouvellement de mot de passe, redirection vers page de login. Si mot de passe différent d'email alors redirection vers demande d'intervention sur site --- .../authentication/ForgottenPasswordAction.java | 23 ++++++++++++++-------- .../main/resources/i18n/wao-web_en_GB.properties | 2 ++ .../main/resources/i18n/wao-web_fr_FR.properties | 2 ++ .../content/authentication/forgotten-password.jsp | 13 +++++------- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/wao-web/src/main/java/fr/ifremer/wao/web/action/authentication/ForgottenPasswordAction.java b/wao-web/src/main/java/fr/ifremer/wao/web/action/authentication/ForgottenPasswordAction.java index ce49700..645303c 100644 --- a/wao-web/src/main/java/fr/ifremer/wao/web/action/authentication/ForgottenPasswordAction.java +++ b/wao-web/src/main/java/fr/ifremer/wao/web/action/authentication/ForgottenPasswordAction.java @@ -4,14 +4,17 @@ import fr.ifremer.wao.services.service.administration.InactiveWaoUserException; import fr.ifremer.wao.services.service.administration.WaoUsersService; import fr.ifremer.wao.services.service.administration.WrongCredentialsException; import fr.ifremer.wao.web.WaoJspActionSupport; +import org.apache.commons.lang3.StringUtils; import org.apache.struts2.convention.annotation.Result; import org.apache.struts2.convention.annotation.Results; +import org.nuiton.util.StringUtil; /** * @since 5.1.2 */ @Results({ - @Result(name="success", type="redirectAction", params = { "namespace", "/authentication", "actionName", "forgotten-password!input", "recovered", "%{recovered}", "login", "%{login}"}) + @Result(name="success", type="redirectAction", params = { "namespace", "/authentication", "actionName", "login!input", "login", "%{login}"}), + @Result(name="none", type="redirectAction", params = { "namespace", "/authentication", "actionName", "forgotten-password!input", "failedNotEmail", "%{failedNotEmail}"}) }) public class ForgottenPasswordAction extends WaoJspActionSupport { @@ -21,7 +24,7 @@ public class ForgottenPasswordAction extends WaoJspActionSupport { protected String login; - protected boolean recovered; + protected boolean failedNotEmail; public void setService(WaoUsersService service) { this.service = service; @@ -30,10 +33,14 @@ public class ForgottenPasswordAction extends WaoJspActionSupport { @Override public String execute() { + if (StringUtils.isNotBlank(login) && ! StringUtil.isEmail(login) ) { + failedNotEmail = true; + return NONE; + } + try { service.askForPasswordReminder(login); - recovered = true; - addActionMessage(t("wao.ui.reminderSent")); + session.addMessage(t("wao.ui.reminderSent")); } catch (WrongCredentialsException credentialException) { addFieldError("login", t("wao.ui.form.authentication.error.wrongCredentials")); return INPUT; @@ -53,11 +60,11 @@ public class ForgottenPasswordAction extends WaoJspActionSupport { return login; } - public boolean isRecovered() { - return recovered; + public boolean isFailedNotEmail() { + return failedNotEmail; } - public void setRecovered(boolean recovered) { - this.recovered = recovered; + public void setFailedNotEmail(boolean failedNotEmail) { + this.failedNotEmail = failedNotEmail; } } diff --git a/wao-web/src/main/resources/i18n/wao-web_en_GB.properties b/wao-web/src/main/resources/i18n/wao-web_en_GB.properties index 1ed6cc8..5512b5f 100644 --- a/wao-web/src/main/resources/i18n/wao-web_en_GB.properties +++ b/wao-web/src/main/resources/i18n/wao-web_en_GB.properties @@ -380,6 +380,7 @@ wao.ui.form.authentication.error.userMustAcceptCgu=You must accept the end-user wao.ui.form.authentication.error.wrongCredentials=Incorrect credentials wao.ui.form.authentication.forgottenPassword.recoverButton=Reset password wao.ui.form.authentication.forgottenPassword.title=Reset your WAO's password +wao.ui.form.authentication.redirectToSIH=Request to intervene on site wao.ui.form.authentication.title=WAO authentication wao.ui.form.boardingFrom=Boardings since wao.ui.form.boatName.placeholder=Name of boat @@ -511,6 +512,7 @@ wao.ui.misc.week=Week wao.ui.misc.year=Year wao.ui.misc.yes=Yes wao.ui.nContactsFound=%s contacts found +wao.ui.needForIntervene=We are not able the recover your password, please feel up a request for intervene on site. wao.ui.news.content=Text wao.ui.news.title=Title wao.ui.page.Administration.title=Administration diff --git a/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties b/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties index f0bba41..c42c311 100644 --- a/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties +++ b/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties @@ -381,6 +381,7 @@ wao.ui.form.authentication.error.userMustAcceptCgu=Vous devez accepter les condi wao.ui.form.authentication.error.wrongCredentials=Les informations d'authenfication ne sont pas correctes wao.ui.form.authentication.forgottenPassword.recoverButton=Demander un nouveau mot de passe wao.ui.form.authentication.forgottenPassword.title=Récupération de votre mot de passe WAO +wao.ui.form.authentication.redirectToSIH=Demande d'intervention sur site wao.ui.form.authentication.title=Identification WAO wao.ui.form.boardingFrom=Sollicitations du navire depuis le wao.ui.form.boatName.placeholder=Nom du bateau @@ -512,6 +513,7 @@ wao.ui.misc.week=Semaine wao.ui.misc.year=Année wao.ui.misc.yes=Oui wao.ui.nContactsFound=%s contacts trouvés +wao.ui.needForIntervene=Nous ne pouvons procéder au renouvellement de votre mot de passe, merci de rédiger une demande d’intervention sur le site. wao.ui.news.content=Texte wao.ui.news.title=Titre wao.ui.page.Administration.title=Administration diff --git a/wao-web/src/main/webapp/WEB-INF/content/authentication/forgotten-password.jsp b/wao-web/src/main/webapp/WEB-INF/content/authentication/forgotten-password.jsp index 8fa421e..05c1401 100644 --- a/wao-web/src/main/webapp/WEB-INF/content/authentication/forgotten-password.jsp +++ b/wao-web/src/main/webapp/WEB-INF/content/authentication/forgotten-password.jsp @@ -17,8 +17,8 @@ <s:form action="forgotten-password" namespace="/authentication" method="POST" cssClass="form-horizontal"> <fieldset> - <s:if test="recovered"> - <s:text name="wao.ui.reminderSent"/> + <s:if test="failedNotEmail"> + <s:text name="wao.ui.needForIntervene"/> </s:if> <s:else> <s:textfield name="login" @@ -27,12 +27,9 @@ </fieldset> <div class="form-actions"> - <s:if test="recovered"> - <s:url namespace="/authentication" action="login!input" id="loginUrl"> - <s:param name="login" value="login" /> - </s:url> - <s:a href="%{loginUrl}" cssClass="btn"> - <s:text name="wao.ui.form.authentication.action.submit"/> + <s:if test="failedNotEmail"> + <s:a href="http://forms.ifremer.fr/sih/wao-demande-dintervention-sur-le-site/" cssClass="btn"> + <s:text name="wao.ui.form.authentication.redirectToSIH"/> </s:a> </s:if> <s:else> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit 957035a31730ce279226408cbb3ce7165d816998 Author: Léo Kaufmann <kaufmann@codelutin.com> Date: Thu Apr 9 15:07:55 2015 +0200 Refs #6844 : Syntaxical correction --- wao-services/src/main/resources/email/UserCredentialsEmail_fr.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wao-services/src/main/resources/email/UserCredentialsEmail_fr.mustache b/wao-services/src/main/resources/email/UserCredentialsEmail_fr.mustache index 191e487..e4f791b 100644 --- a/wao-services/src/main/resources/email/UserCredentialsEmail_fr.mustache +++ b/wao-services/src/main/resources/email/UserCredentialsEmail_fr.mustache @@ -1,6 +1,6 @@ Bonjour {{waoUser.firstName}}, -Vos identifiants de connexion ont changés. +Vos identifiants de connexion ont changé. Votre identifiant : {{waoUser.login}} -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit 21521ad790eac9f04852feb30b01f96ba734237d Merge: adcd234 957035a Author: Brendan Le Ny <bleny@codelutin.com> Date: Thu Apr 9 15:18:55 2015 +0200 Fusion de la branche 'feature/6844-forgotenPassword' dans develop (termine #6844) .../java/fr/ifremer/wao/AbstractWaoTopiaDao.java | 14 ++-- .../src/main/java/fr/ifremer/wao/WaoUtils.java | 5 ++ .../service/administration/WaoUsersService.java | 94 ++++++++++++++-------- .../email/UserCredentialsEmail_fr.mustache | 2 +- .../wao/services/service/ObsMerFixtures.java | 4 + .../ifremer/wao/services/service/WaoFixtures.java | 9 +++ .../administration/WaoUsersServiceTest.java | 44 ++++++++++ .../java/fr/ifremer/wao/web/WaoInterceptor.java | 5 +- .../authentication/ForgottenPasswordAction.java | 70 ++++++++++++++++ .../main/resources/i18n/wao-web_en_GB.properties | 5 ++ .../main/resources/i18n/wao-web_fr_FR.properties | 5 ++ .../content/authentication/forgotten-password.jsp | 45 +++++++++++ .../WEB-INF/content/authentication/login.jsp | 18 +++-- wao-web/src/main/webapp/WEB-INF/decorators.xml | 1 + 14 files changed, 276 insertions(+), 45 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm