You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2014/09/26 12:50:38 UTC

svn commit: r1627742 - in /syncope/branches/1_2_X: ./ common/src/main/java/org/apache/syncope/common/util/ console/src/main/java/org/apache/syncope/console/commons/ console/src/main/java/org/apache/syncope/console/pages/ console/src/main/java/org/apach...

Author: ilgrosso
Date: Fri Sep 26 10:50:37 2014
New Revision: 1627742

URL: http://svn.apache.org/r1627742
Log:
[SYNCOPE-135] Handling of the whole password reset process now available via admin console

Added:
    syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.java
      - copied, changed from r1627044, syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/RequestPasswordResetModalPage.java
    syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.html   (with props)
    syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.properties   (with props)
    syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage_it.properties   (with props)
    syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage_pt_BR.properties   (with props)
Modified:
    syncope/branches/1_2_X/common/src/main/java/org/apache/syncope/common/util/AttributableOperations.java
    syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/commons/Constants.java
    syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/Login.java
    syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/RequestPasswordResetModalPage.java
    syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/ResultStatusModalPage.java
    syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/panels/SecurityQuestionPanel.java
    syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/Login.html
    syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/RequestPasswordResetModalPage.properties
    syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/RequestPasswordResetModalPage_it.properties
    syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/RequestPasswordResetModalPage_pt_BR.properties
    syncope/branches/1_2_X/console/src/test/java/org/apache/syncope/console/ConfigurationTestITCase.java
    syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java
    syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java
    syncope/branches/1_2_X/core/src/main/resources/mailTemplates/requestPasswordReset.html.vm
    syncope/branches/1_2_X/core/src/main/resources/mailTemplates/requestPasswordReset.txt.vm
    syncope/branches/1_2_X/pom.xml

Modified: syncope/branches/1_2_X/common/src/main/java/org/apache/syncope/common/util/AttributableOperations.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/common/src/main/java/org/apache/syncope/common/util/AttributableOperations.java?rev=1627742&r1=1627741&r2=1627742&view=diff
==============================================================================
--- syncope/branches/1_2_X/common/src/main/java/org/apache/syncope/common/util/AttributableOperations.java (original)
+++ syncope/branches/1_2_X/common/src/main/java/org/apache/syncope/common/util/AttributableOperations.java Fri Sep 26 10:50:37 2014
@@ -26,6 +26,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import org.apache.commons.lang3.SerializationUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.mod.AbstractAttributableMod;
 import org.apache.syncope.common.mod.AbstractSubjectMod;
 import org.apache.syncope.common.mod.AttributeMod;
@@ -236,8 +237,15 @@ public final class AttributableOperation
         }
 
         // 3. security question / answer
-        result.setSecurityQuestion(updated.getSecurityQuestion());
-        result.setSecurityAnswer(updated.getSecurityAnswer());
+        if (updated.getSecurityQuestion() == null) {
+            result.setSecurityQuestion(null);
+            result.setSecurityAnswer(null);
+        } else if (!updated.getSecurityQuestion().equals(original.getSecurityQuestion())
+                || StringUtils.isNotBlank(updated.getSecurityAnswer())) {
+
+            result.setSecurityQuestion(updated.getSecurityQuestion());
+            result.setSecurityAnswer(updated.getSecurityAnswer());
+        }
 
         // 4. memberships
         Map<Long, MembershipTO> updatedMembs = updated.getMembershipMap();

Modified: syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/commons/Constants.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/commons/Constants.java?rev=1627742&r1=1627741&r2=1627742&view=diff
==============================================================================
--- syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/commons/Constants.java (original)
+++ syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/commons/Constants.java Fri Sep 26 10:50:37 2014
@@ -38,6 +38,8 @@ public final class Constants {
 
     public static final String ERROR = "error";
 
+    public static final String PARAM_PASSWORD_RESET_TOKEN = "pwdResetToken";
+
     public static final String PREF_USERS_DETAILS_VIEW = "users.details.view";
 
     public static final String PREF_USERS_ATTRIBUTES_VIEW = "users.attributes.view";

Copied: syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.java (from r1627044, syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/RequestPasswordResetModalPage.java)
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.java?p2=syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.java&p1=syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/RequestPasswordResetModalPage.java&r1=1627044&r2=1627742&rev=1627742&view=diff
==============================================================================
--- syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/RequestPasswordResetModalPage.java (original)
+++ syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.java Fri Sep 26 10:50:37 2014
@@ -18,71 +18,43 @@
  */
 package org.apache.syncope.console.pages;
 
-import static org.apache.syncope.console.pages.AbstractBasePage.FORM;
-import static org.apache.syncope.console.pages.AbstractBasePage.LOG;
-
-import org.apache.syncope.common.to.SecurityQuestionTO;
+import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.console.commons.Constants;
-import org.apache.syncope.console.rest.SecurityQuestionRestClient;
-import org.apache.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.apache.syncope.console.wicket.markup.html.form.AjaxPasswordFieldPanel;
+import org.apache.syncope.console.wicket.markup.html.form.FieldPanel;
 import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
 import org.apache.wicket.ajax.markup.html.form.AjaxButton;
 import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
 import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.PasswordTextField;
+import org.apache.wicket.markup.html.form.StatelessForm;
+import org.apache.wicket.markup.html.form.validation.EqualPasswordInputValidator;
 import org.apache.wicket.model.Model;
 import org.apache.wicket.model.ResourceModel;
-import org.apache.wicket.spring.injection.annot.SpringBean;
 
-public class RequestPasswordResetModalPage extends BaseModalPage {
+public class ConfirmPasswordResetModalPage extends BaseModalPage {
 
     private static final long serialVersionUID = -8419445804421211904L;
 
-    @SpringBean
-    private SecurityQuestionRestClient securityQuestionRestClient;
-
-    public RequestPasswordResetModalPage(final ModalWindow window) {
+    public ConfirmPasswordResetModalPage(final ModalWindow window, final String token) {
         super();
         setOutputMarkupId(true);
 
-        final Form<?> form = new Form<Object>(FORM);
+        final StatelessForm<?> form = new StatelessForm<Object>(FORM);
         form.setOutputMarkupId(true);
 
-        final AjaxTextFieldPanel securityQuestion =
-                new AjaxTextFieldPanel("securityQuestion", "securityQuestion", new Model<String>());
-        securityQuestion.setReadOnly(true);
-        securityQuestion.setRequired(true);
-        securityQuestion.getField().setOutputMarkupId(true);
-        form.add(securityQuestion);
-
-        final AjaxTextFieldPanel username =
-                new AjaxTextFieldPanel("username", "username", new Model<String>());
-        username.setRequired(true);
-        username.getField().setOutputMarkupId(true);
-        username.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
-
-            private static final long serialVersionUID = -1107858522700306810L;
-
-            @Override
-            protected void onUpdate(final AjaxRequestTarget target) {
-                try {
-                    SecurityQuestionTO read = securityQuestionRestClient.readByUser(username.getModelObject());
-                    securityQuestion.setModelObject(read.getContent());
-                    target.add(securityQuestion);
-                } catch (Exception e) {
-                    LOG.error("While fetching security question for {}", username.getModelObject(), e);
-                    error(getString(Constants.ERROR) + ": " + e.getMessage());
-                    feedbackPanel.refresh(target);
-                }
-            }
-        });
-        form.add(username);
+        final FieldPanel<String> password =
+                new AjaxPasswordFieldPanel("password", "password", new Model<String>()).setRequired(true);
+        ((PasswordTextField) password.getField()).setResetPassword(true);
+        form.add(password);
+
+        final FieldPanel<String> confirmPassword =
+                new AjaxPasswordFieldPanel("confirmPassword", "confirmPassword", new Model<String>());
+        ((PasswordTextField) confirmPassword.getField()).setResetPassword(true);
+        form.add(confirmPassword);
 
-        final AjaxTextFieldPanel securityAnswer =
-                new AjaxTextFieldPanel("securityAnswer", "securityAnswer", new Model<String>());
-        securityAnswer.setRequired(true);
-        form.add(securityAnswer);
+        form.add(new EqualPasswordInputValidator(password.getField(), confirmPassword.getField()));
 
         final AjaxButton submit = new IndicatingAjaxButton(APPLY, new ResourceModel(SUBMIT, SUBMIT)) {
 
@@ -91,14 +63,21 @@ public class RequestPasswordResetModalPa
             @Override
             protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
                 try {
-                    userSelfRestClient.requestPasswordReset(username.getModelObject(), securityAnswer.getModelObject());
-                    window.close(target);
+                    userSelfRestClient.confirmPasswordReset(token, password.getModelObject());
+
+                    setResponsePage(new ResultStatusModalPage.Builder(window, new UserTO()).
+                            mode(UserModalPage.Mode.SELF).build());
                 } catch (Exception e) {
-                    LOG.error("While requesting password reset for {}", username.getModelObject(), e);
+                    LOG.error("While confirming password reset for {}", token, e);
                     error(getString(Constants.ERROR) + ": " + e.getMessage());
                     feedbackPanel.refresh(target);
                 }
             }
+
+            @Override
+            protected void onError(final AjaxRequestTarget target, final Form<?> form) {
+                feedbackPanel.refresh(target);
+            }
         };
         form.add(submit);
         form.setDefaultButton(submit);

Modified: syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/Login.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/Login.java?rev=1627742&r1=1627741&r2=1627742&view=diff
==============================================================================
--- syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/Login.java (original)
+++ syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/Login.java Fri Sep 26 10:50:37 2014
@@ -21,6 +21,7 @@ package org.apache.syncope.console.pages
 import java.security.AccessControlException;
 import java.util.List;
 import java.util.Locale;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.services.EntitlementService;
 import org.apache.syncope.common.wrap.EntitlementTO;
 import org.apache.syncope.common.to.UserTO;
@@ -31,23 +32,29 @@ import org.apache.syncope.console.pages.
 import org.apache.syncope.console.rest.UserSelfRestClient;
 import org.apache.syncope.console.wicket.ajax.markup.html.ClearIndicatingAjaxLink;
 import org.apache.syncope.console.wicket.markup.html.form.LinkPanel;
+import org.apache.wicket.Component;
 import org.apache.wicket.Page;
+import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
 import org.apache.wicket.ajax.markup.html.form.AjaxButton;
 import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
 import org.apache.wicket.markup.html.WebPage;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.form.ChoiceRenderer;
 import org.apache.wicket.markup.html.form.DropDownChoice;
 import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.markup.html.form.PasswordTextField;
+import org.apache.wicket.markup.html.form.StatelessForm;
 import org.apache.wicket.markup.html.form.TextField;
 import org.apache.wicket.markup.html.panel.Fragment;
 import org.apache.wicket.markup.html.panel.Panel;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.Model;
 import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.request.cycle.RequestCycle;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.spring.injection.annot.SpringBean;
 
@@ -78,7 +85,7 @@ public class Login extends WebPage {
     @SpringBean
     private UserSelfRestClient userSelfRestClient;
 
-    private final Form<Void> form;
+    private final StatelessForm<Void> form;
 
     private final TextField<String> userIdField;
 
@@ -90,11 +97,12 @@ public class Login extends WebPage {
 
     public Login(final PageParameters parameters) {
         super(parameters);
+        setStatelessHint(true);
 
         feedbackPanel = new NotificationPanel(Constants.FEEDBACK);
         add(feedbackPanel);
 
-        form = new Form<Void>("login");
+        form = new StatelessForm<Void>("login");
 
         userIdField = new TextField<String>("userId", new Model<String>());
         userIdField.setMarkupId("userId");
@@ -190,13 +198,13 @@ public class Login extends WebPage {
         }
         add(selfRegFrag);
 
-        // Modal window for password reset
-        final ModalWindow pwdResetModalWin = new ModalWindow("pwdResetModal");
-        pwdResetModalWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
-        pwdResetModalWin.setInitialHeight(PWD_RESET_WIN_HEIGHT);
-        pwdResetModalWin.setInitialWidth(PWD_RESET_WIN_WIDTH);
-        pwdResetModalWin.setCookieName("pwd-reset-modal");
-        add(pwdResetModalWin);
+        // Modal window for password reset request
+        final ModalWindow pwdResetReqModalWin = new ModalWindow("pwdResetReqModal");
+        pwdResetReqModalWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
+        pwdResetReqModalWin.setInitialHeight(PWD_RESET_WIN_HEIGHT);
+        pwdResetReqModalWin.setInitialWidth(PWD_RESET_WIN_WIDTH);
+        pwdResetReqModalWin.setCookieName("pwd-reset-req-modal");
+        add(pwdResetReqModalWin);
 
         Fragment pwdResetFrag;
         if (userSelfRestClient.isPasswordResetAllowed()) {
@@ -208,7 +216,7 @@ public class Login extends WebPage {
 
                 @Override
                 protected void onClickInternal(final AjaxRequestTarget target) {
-                    pwdResetModalWin.setPageCreator(new ModalWindow.PageCreator() {
+                    pwdResetReqModalWin.setPageCreator(new ModalWindow.PageCreator() {
 
                         private static final long serialVersionUID = -7834632442532690940L;
 
@@ -217,21 +225,22 @@ public class Login extends WebPage {
                             // anonymous authentication needed for password reset request
                             authenticate(anonymousUser, anonymousKey);
 
-                            return new RequestPasswordResetModalPage(pwdResetModalWin);
+                            return new RequestPasswordResetModalPage(pwdResetReqModalWin);
                         }
                     });
 
-                    pwdResetModalWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
+                    pwdResetReqModalWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
 
                         private static final long serialVersionUID = 8804221891699487139L;
 
                         @Override
                         public void onClose(final AjaxRequestTarget target) {
                             SyncopeSession.get().invalidate();
+                            setResponsePage(Login.class);
                         }
                     });
 
-                    pwdResetModalWin.show(target);
+                    pwdResetReqModalWin.show(target);
                 }
             };
             pwdResetLink.add(new Label("linkTitle", getString("passwordReset")));
@@ -243,6 +252,55 @@ public class Login extends WebPage {
             pwdResetFrag = new Fragment("passwordReset", "pwdResetNotAllowed", this);
         }
         add(pwdResetFrag);
+
+        // Modal window for password reset confirm - automatically shown when token is available as request parameter
+        final String pwdResetToken = RequestCycle.get().getRequest().getRequestParameters().
+                getParameterValue(Constants.PARAM_PASSWORD_RESET_TOKEN).toOptionalString();
+        final ModalWindow pwdResetConfModalWin = new ModalWindow("pwdResetConfModal");
+        if (StringUtils.isNotBlank(pwdResetToken)) {
+            pwdResetConfModalWin.add(new AbstractDefaultAjaxBehavior() {
+
+                private static final long serialVersionUID = 3109256773218160485L;
+
+                @Override
+                protected void respond(final AjaxRequestTarget target) {
+                    ModalWindow window = (ModalWindow) getComponent();
+                    window.show(target);
+                }
+
+                @Override
+                public void renderHead(final Component component, final IHeaderResponse response) {
+                    response.render(JavaScriptHeaderItem.forScript(getCallbackScript(), null));
+                }
+            });
+        }
+        pwdResetConfModalWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
+        pwdResetConfModalWin.setInitialHeight(PWD_RESET_WIN_HEIGHT);
+        pwdResetConfModalWin.setInitialWidth(PWD_RESET_WIN_WIDTH);
+        pwdResetConfModalWin.setCookieName("pwd-reset-conf-modal");
+        pwdResetConfModalWin.setPageCreator(new ModalWindow.PageCreator() {
+
+            private static final long serialVersionUID = -7834632442532690940L;
+
+            @Override
+            public Page createPage() {
+                // anonymous authentication needed for password reset confirm
+                authenticate(anonymousUser, anonymousKey);
+
+                return new ConfirmPasswordResetModalPage(pwdResetConfModalWin, pwdResetToken);
+            }
+        });
+        pwdResetConfModalWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
+
+            private static final long serialVersionUID = 8804221891699487139L;
+
+            @Override
+            public void onClose(final AjaxRequestTarget target) {
+                SyncopeSession.get().invalidate();
+                setResponsePage(Login.class);
+            }
+        });
+        add(pwdResetConfModalWin);
     }
 
     private void authenticate(final String username, final String password) {

Modified: syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/RequestPasswordResetModalPage.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/RequestPasswordResetModalPage.java?rev=1627742&r1=1627741&r2=1627742&view=diff
==============================================================================
--- syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/RequestPasswordResetModalPage.java (original)
+++ syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/RequestPasswordResetModalPage.java Fri Sep 26 10:50:37 2014
@@ -18,10 +18,8 @@
  */
 package org.apache.syncope.console.pages;
 
-import static org.apache.syncope.console.pages.AbstractBasePage.FORM;
-import static org.apache.syncope.console.pages.AbstractBasePage.LOG;
-
 import org.apache.syncope.common.to.SecurityQuestionTO;
+import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.console.commons.Constants;
 import org.apache.syncope.console.rest.SecurityQuestionRestClient;
 import org.apache.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
@@ -31,6 +29,7 @@ import org.apache.wicket.ajax.markup.htm
 import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
 import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.StatelessForm;
 import org.apache.wicket.model.Model;
 import org.apache.wicket.model.ResourceModel;
 import org.apache.wicket.spring.injection.annot.SpringBean;
@@ -46,7 +45,7 @@ public class RequestPasswordResetModalPa
         super();
         setOutputMarkupId(true);
 
-        final Form<?> form = new Form<Object>(FORM);
+        final StatelessForm<?> form = new StatelessForm<Object>(FORM);
         form.setOutputMarkupId(true);
 
         final AjaxTextFieldPanel securityQuestion =
@@ -92,13 +91,20 @@ public class RequestPasswordResetModalPa
             protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
                 try {
                     userSelfRestClient.requestPasswordReset(username.getModelObject(), securityAnswer.getModelObject());
-                    window.close(target);
+
+                    setResponsePage(new ResultStatusModalPage.Builder(window, new UserTO()).
+                            mode(UserModalPage.Mode.SELF).build());
                 } catch (Exception e) {
                     LOG.error("While requesting password reset for {}", username.getModelObject(), e);
                     error(getString(Constants.ERROR) + ": " + e.getMessage());
                     feedbackPanel.refresh(target);
                 }
             }
+
+            @Override
+            protected void onError(final AjaxRequestTarget target, final Form<?> form) {
+                feedbackPanel.refresh(target);
+            }
         };
         form.add(submit);
         form.setDefaultButton(submit);

Modified: syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/ResultStatusModalPage.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/ResultStatusModalPage.java?rev=1627742&r1=1627741&r2=1627742&view=diff
==============================================================================
--- syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/ResultStatusModalPage.java (original)
+++ syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/ResultStatusModalPage.java Fri Sep 26 10:50:37 2014
@@ -33,7 +33,6 @@ import org.apache.syncope.common.to.Prop
 import org.apache.syncope.common.to.RoleTO;
 import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.common.types.PropagationTaskExecStatus;
-import org.apache.syncope.console.SyncopeSession;
 import org.apache.syncope.console.commons.ConnIdSpecialAttributeName;
 import org.apache.syncope.console.commons.Constants;
 import org.apache.syncope.console.commons.status.Status;
@@ -135,10 +134,10 @@ public class ResultStatusModalPage exten
 
             fragment.add(new Label("info",
                     ((subject instanceof UserTO) && ((UserTO) subject).getUsername() != null)
-                    ? ((UserTO) subject).getUsername()
-                    : ((subject instanceof RoleTO) && ((RoleTO) subject).getName() != null)
-                    ? ((RoleTO) subject).getName()
-                    : String.valueOf(subject.getId())));
+                            ? ((UserTO) subject).getUsername()
+                            : ((subject instanceof RoleTO) && ((RoleTO) subject).getName() != null)
+                                    ? ((RoleTO) subject).getName()
+                                    : String.valueOf(subject.getId())));
 
             final ListView<PropagationStatus> propRes = new ListView<PropagationStatus>("resources",
                     propagations) {
@@ -164,7 +163,7 @@ public class ResultStatusModalPage exten
                             attrhead.add(new Label("resource", propTO.getResource()));
 
                             attrhead.add(new Label("propagation", propTO.getStatus() == null
-                                            ? "UNDEFINED" : propTO.getStatus().toString()));
+                                                    ? "UNDEFINED" : propTO.getStatus().toString()));
 
                             final Image image;
                             final String alt, title;
@@ -243,9 +242,6 @@ public class ResultStatusModalPage exten
 
             @Override
             public void onClick(final AjaxRequestTarget target) {
-                if (mode == UserModalPage.Mode.SELF && anonymousUser.equals(SyncopeSession.get().getUsername())) {
-                    SyncopeSession.get().invalidate();
-                }
                 builder.window.close(target);
             }
         };

Modified: syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/panels/SecurityQuestionPanel.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/panels/SecurityQuestionPanel.java?rev=1627742&r1=1627741&r2=1627742&view=diff
==============================================================================
--- syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/panels/SecurityQuestionPanel.java (original)
+++ syncope/branches/1_2_X/console/src/main/java/org/apache/syncope/console/pages/panels/SecurityQuestionPanel.java Fri Sep 26 10:50:37 2014
@@ -55,6 +55,7 @@ public class SecurityQuestionPanel exten
         final AjaxTextFieldPanel securityAnswer = new AjaxTextFieldPanel("securityAnswer", "securityAnswer",
                 new PropertyModel<String>(userTO, "securityAnswer"));
         securityAnswer.getField().setOutputMarkupId(true);
+        securityAnswer.setEnabled(false);
         add(securityAnswer);
 
         final AjaxDropDownChoicePanel<Long> securityQuestion =
@@ -86,11 +87,12 @@ public class SecurityQuestionPanel exten
             protected void onUpdate(final AjaxRequestTarget target) {
                 if (securityQuestion.getModelObject() == null) {
                     securityAnswer.setModelObject(null);
-                    target.add(SecurityQuestionPanel.this);
+                } else {
+                    securityAnswer.setEnabled(true);
                 }
+                target.add(SecurityQuestionPanel.this);
             }
         });
         add(securityQuestion);
     }
-
 }

Added: syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.html
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.html?rev=1627742&view=auto
==============================================================================
--- syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.html (added)
+++ syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.html Fri Sep 26 10:50:37 2014
@@ -0,0 +1,55 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
+  <wicket:extend>
+    <div>
+      <p class="ui-widget ui-corner-all ui-widget-header"><wicket:message key="title"/></p>
+      <form wicket:id="form">
+        <div id="formtable">
+          <div class="tablerow alt">
+            <div class="tablecolumn_label medium_fixedsize">
+              <label for="password"><wicket:message key="password"/></label>
+            </div>
+            <div class="tablecolumn_field medium_dynamicsize">
+              <span wicket:id="password">[password]</span>
+            </div>
+          </div>
+
+          <div class="tablerow">
+            <div class="tablecolumn_label medium_fixedsize">
+              <label for="confirmPassword"><wicket:message key="confirmPassword"/></label>
+            </div>
+            <div class="tablecolumn_field medium_dynamicsize">
+              <span wicket:id="confirmPassword">[confirmPassword]</span>
+            </div>
+          </div>
+        </div>
+
+        <div style="margin: 20px 10px 0">
+          <input type="submit"
+                 class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
+                 wicket:id="apply"/>
+          <input type="button"
+                 class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
+                 wicket:id="cancel"/>
+        </div>
+      </form>
+    </div>
+  </wicket:extend>
+</html>

Propchange: syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.html
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.properties
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.properties?rev=1627742&view=auto
==============================================================================
--- syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.properties (added)
+++ syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.properties Fri Sep 26 10:50:37 2014
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+title=Password reset
+submit=Submit
+password=Password
+confirmPassword=Password (confirm)

Propchange: syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage.properties
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Added: syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage_it.properties
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage_it.properties?rev=1627742&view=auto
==============================================================================
--- syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage_it.properties (added)
+++ syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage_it.properties Fri Sep 26 10:50:37 2014
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+title=Password smarrita
+submit=Invia
+password=Password
+confirmPassword=Password (conferma)

Propchange: syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage_it.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage_it.properties
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Added: syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage_pt_BR.properties
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage_pt_BR.properties?rev=1627742&view=auto
==============================================================================
--- syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage_pt_BR.properties (added)
+++ syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage_pt_BR.properties Fri Sep 26 10:50:37 2014
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+title=Redefini\u00e7\u00e3o de senha
+submit=Apresentar
+password=Senha
+confirmPassword=Senha (confirmar)

Propchange: syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage_pt_BR.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/ConfirmPasswordResetModalPage_pt_BR.properties
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Modified: syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/Login.html
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/Login.html?rev=1627742&r1=1627741&r2=1627742&view=diff
==============================================================================
--- syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/Login.html (original)
+++ syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/Login.html Fri Sep 26 10:50:37 2014
@@ -82,7 +82,8 @@ under the License.
         <span wicket:id="passwordReset"/>
       </wicket:fragment>
 
-      <div wicket:id="pwdResetModal"></div>
+      <div wicket:id="pwdResetReqModal"></div>
+      <div wicket:id="pwdResetConfModal"></div>
     </div>
   </body>
 </html>

Modified: syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/RequestPasswordResetModalPage.properties
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/RequestPasswordResetModalPage.properties?rev=1627742&r1=1627741&r2=1627742&view=diff
==============================================================================
--- syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/RequestPasswordResetModalPage.properties (original)
+++ syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/RequestPasswordResetModalPage.properties Fri Sep 26 10:50:37 2014
@@ -18,3 +18,4 @@ securityQuestion=Security question
 title=Password reset
 username=User
 securityAnswer=Security answer
+submit=Submit

Modified: syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/RequestPasswordResetModalPage_it.properties
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/RequestPasswordResetModalPage_it.properties?rev=1627742&r1=1627741&r2=1627742&view=diff
==============================================================================
--- syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/RequestPasswordResetModalPage_it.properties (original)
+++ syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/RequestPasswordResetModalPage_it.properties Fri Sep 26 10:50:37 2014
@@ -18,3 +18,4 @@ securityQuestion=Domanda di sicurezza
 title=Password smarrita
 username=Utente
 securityAnswer=Risposta di sicurezza
+submit=Invia

Modified: syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/RequestPasswordResetModalPage_pt_BR.properties
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/RequestPasswordResetModalPage_pt_BR.properties?rev=1627742&r1=1627741&r2=1627742&view=diff
==============================================================================
--- syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/RequestPasswordResetModalPage_pt_BR.properties (original)
+++ syncope/branches/1_2_X/console/src/main/resources/org/apache/syncope/console/pages/RequestPasswordResetModalPage_pt_BR.properties Fri Sep 26 10:50:37 2014
@@ -18,3 +18,4 @@ securityQuestion=Pergunta de seguran\u00
 title=Redefini\u00e7\u00e3o de senha
 username=Usu\u00e1rio
 securityAnswer=Resposta de seguran\u00e7a
+submit=Apresentar

Modified: syncope/branches/1_2_X/console/src/test/java/org/apache/syncope/console/ConfigurationTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/console/src/test/java/org/apache/syncope/console/ConfigurationTestITCase.java?rev=1627742&r1=1627741&r2=1627742&view=diff
==============================================================================
--- syncope/branches/1_2_X/console/src/test/java/org/apache/syncope/console/ConfigurationTestITCase.java (original)
+++ syncope/branches/1_2_X/console/src/test/java/org/apache/syncope/console/ConfigurationTestITCase.java Fri Sep 26 10:50:37 2014
@@ -74,7 +74,7 @@ public class ConfigurationTestITCase ext
 
         selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
 
-        selenium.click("//div[@id='tabs']/ul/li[5]/a");
+        selenium.click("//div[@id='tabs']/ul/li[6]/a");
 
         selenium.select("//div[@id='core']/div/span/table/tbody/tr/td[2]/select", "label=ERROR");
 
@@ -151,7 +151,7 @@ public class ConfigurationTestITCase ext
 
         selenium.click("//div[@class='eventSelectionWidzard']/div[2]/div[3]/span/div/input");
 
-        selenium.click("//div[2]/form/div[3]/ul/li[4]/a/span");
+        selenium.click("//div[2]/form/div[3]/ul/li[4]/a");
 
         selenium.click("//div[2]/form/div[3]/div[4]/div/div/span/input");
 

Modified: syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java?rev=1627742&r1=1627741&r2=1627742&view=diff
==============================================================================
--- syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java (original)
+++ syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java Fri Sep 26 10:50:37 2014
@@ -67,7 +67,7 @@ import org.springframework.transaction.a
 public class UserDataBinder extends AbstractAttributableDataBinder {
 
     private static final String[] IGNORE_USER_PROPERTIES = {
-        "memberships", "attrs", "derAttrs", "virAttrs", "resources", "securityQuestion"
+        "memberships", "attrs", "derAttrs", "virAttrs", "resources", "securityQuestion", "securityAnswer"
     };
 
     @Autowired

Modified: syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java?rev=1627742&r1=1627741&r2=1627742&view=diff
==============================================================================
--- syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java (original)
+++ syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java Fri Sep 26 10:50:37 2014
@@ -68,6 +68,7 @@ import org.apache.syncope.common.Syncope
 import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
 import org.apache.syncope.core.persistence.dao.NotFoundException;
 import org.apache.syncope.core.persistence.validation.attrvalue.ParsingValidationException;
+import org.apache.syncope.core.persistence.validation.entity.InvalidEntityException;
 import org.apache.syncope.core.propagation.PropagationByResource;
 import org.apache.syncope.core.rest.controller.UnauthorizedRoleException;
 import org.apache.syncope.core.rest.data.UserDataBinder;
@@ -167,6 +168,8 @@ public class ActivitiUserWorkflowAdapter
                 throw (SyncopeClientException) e.getCause().getCause();
             } else if (e.getCause().getCause() instanceof ParsingValidationException) {
                 throw (ParsingValidationException) e.getCause().getCause();
+            } else if (e.getCause().getCause() instanceof InvalidEntityException) {
+                throw (InvalidEntityException) e.getCause().getCause();
             }
         }
 

Modified: syncope/branches/1_2_X/core/src/main/resources/mailTemplates/requestPasswordReset.html.vm
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/core/src/main/resources/mailTemplates/requestPasswordReset.html.vm?rev=1627742&r1=1627741&r2=1627742&view=diff
==============================================================================
--- syncope/branches/1_2_X/core/src/main/resources/mailTemplates/requestPasswordReset.html.vm (original)
+++ syncope/branches/1_2_X/core/src/main/resources/mailTemplates/requestPasswordReset.html.vm Fri Sep 26 10:50:37 2014
@@ -21,8 +21,8 @@ under the License.
 <p>Hi,
 a password reset was request for $user.getUsername().</p>
 
-<p>In order to complete this request, you need to provide the token<br/><br/>
-$input.get(0)</p>
+<p>In order to complete this request, you need to visit this 
+<a href="http://localhost:9080/syncope-console/?pwdResetToken=$input.get(0)">link</a></p>.
 
 <p>If you did not request this reset, just ignore the present e-mail.</p>
 

Modified: syncope/branches/1_2_X/core/src/main/resources/mailTemplates/requestPasswordReset.txt.vm
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/core/src/main/resources/mailTemplates/requestPasswordReset.txt.vm?rev=1627742&r1=1627741&r2=1627742&view=diff
==============================================================================
--- syncope/branches/1_2_X/core/src/main/resources/mailTemplates/requestPasswordReset.txt.vm (original)
+++ syncope/branches/1_2_X/core/src/main/resources/mailTemplates/requestPasswordReset.txt.vm Fri Sep 26 10:50:37 2014
@@ -17,9 +17,9 @@
 Hi,
 a password reset was request for $user.getUsername().
 
-In order to complete this request, you need to provide the token 
+In order to complete this request, you need to visit this link:
 
-$input.get(0)
+http://localhost:9080/syncope-console/?pwdResetToken=$input.get(0)
 
 If you did not request this reset, just ignore the present e-mail.
 

Modified: syncope/branches/1_2_X/pom.xml
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/pom.xml?rev=1627742&r1=1627741&r2=1627742&view=diff
==============================================================================
--- syncope/branches/1_2_X/pom.xml (original)
+++ syncope/branches/1_2_X/pom.xml Fri Sep 26 10:50:37 2014
@@ -1148,7 +1148,7 @@ under the License.
         <plugin>
           <groupId>org.codehaus.cargo</groupId>
           <artifactId>cargo-maven2-plugin</artifactId>
-          <version>1.4.9</version>
+          <version>1.4.10</version>
           <configuration>
             <container>
               <containerId>tomcat7x</containerId>