Looks good to me; please feel free to merge it into master. On 6 January 2015 at 18:53, Martin Grigorov <[email protected]> wrote:
> Please check branch ISIS-987-PageNavigationService. > I've introduced a new service that helps with navigating to other pages by > PageType > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Tue, Jan 6, 2015 at 11:58 AM, Martin Grigorov <[email protected]> > wrote: > > > Yes. I'll do it soon. > > > > Martin Grigorov > > Wicket Training and Consulting > > https://twitter.com/mtgrigorov > > > > On Tue, Jan 6, 2015 at 11:45 AM, Dan Haywood < > [email protected] > > > wrote: > > > >> yes, my bad. Can you make the fix if you didn't already. > >> > >> cheers > >> Dan > >> > >> On 6 January 2015 at 09:38, Martin Grigorov <[email protected]> > wrote: > >> > >> > On Mon, Jan 5, 2015 at 10:07 PM, <[email protected]> wrote: > >> > > >> > > ISIS-987: don't allow the user to navigate to the signUp or password > >> > reset > >> > > pages if that functionality has been suppressed. > >> > > > >> > > > >> > > Project: http://git-wip-us.apache.org/repos/asf/isis/repo > >> > > Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/1ca9c59d > >> > > Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/1ca9c59d > >> > > Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/1ca9c59d > >> > > > >> > > Branch: refs/heads/master > >> > > Commit: 1ca9c59d9da85065da17ecdc074a01c562d5dcb7 > >> > > Parents: 0ed6be7 > >> > > Author: Dan Haywood <[email protected]> > >> > > Authored: Mon Jan 5 20:06:56 2015 +0000 > >> > > Committer: Dan Haywood <[email protected]> > >> > > Committed: Mon Jan 5 20:06:56 2015 +0000 > >> > > > >> > > > ---------------------------------------------------------------------- > >> > > .../accmngt/password_reset/PasswordResetPage.java | 9 ++++++++- > >> > > .../pages/accmngt/signup/RegistrationFormPage.java | 8 ++++++++ > >> > > .../wicket/ui/pages/login/WicketSignInPage.java | 15 > >> > ++++++++++----- > >> > > 3 files changed, 26 insertions(+), 6 deletions(-) > >> > > > ---------------------------------------------------------------------- > >> > > > >> > > > >> > > > >> > > > >> > > >> > http://git-wip-us.apache.org/repos/asf/isis/blob/1ca9c59d/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPage.java > >> > > > ---------------------------------------------------------------------- > >> > > diff --git > >> > > > >> > > >> > a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPage.java > >> > > > >> > > >> > b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPage.java > >> > > index 8386fa4..ff5b913 100644 > >> > > --- > >> > > > >> > > >> > a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPage.java > >> > > +++ > >> > > > >> > > >> > b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPage.java > >> > > @@ -22,14 +22,16 @@ package > >> > > org.apache.isis.viewer.wicket.ui.pages.accmngt.password_reset; > >> > > import > >> > > > >> > > >> > de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationPanel; > >> > > > >> > > import java.util.concurrent.Callable; > >> > > +import org.apache.wicket.RestartResponseAtInterceptPageException; > >> > > import org.apache.wicket.request.mapper.parameter.PageParameters; > >> > > import org.apache.wicket.util.string.StringValue; > >> > > import org.apache.wicket.util.string.Strings; > >> > > import > >> org.apache.isis.applib.services.userreg.UserRegistrationService; > >> > > import org.apache.isis.core.runtime.system.context.IsisContext; > >> > > import org.apache.isis.viewer.wicket.ui.errors.ExceptionModel; > >> > > -import > >> > > > >> > > >> > org.apache.isis.viewer.wicket.ui.pages.accmngt.AccountManagementPageAbstract; > >> > > import > >> > > > org.apache.isis.viewer.wicket.ui.pages.accmngt.AccountConfirmationMap; > >> > > +import > >> > > > >> > > >> > org.apache.isis.viewer.wicket.ui.pages.accmngt.AccountManagementPageAbstract; > >> > > +import > org.apache.isis.viewer.wicket.ui.pages.login.WicketSignInPage; > >> > > > >> > > /** > >> > > * A page used for resetting the password of an user. > >> > > @@ -46,6 +48,11 @@ public class PasswordResetPage extends > >> > > AccountManagementPageAbstract { > >> > > > >> > > private PasswordResetPage(final PageParameters parameters, > >> > > ExceptionModel exceptionModel) { > >> > > super(parameters, exceptionModel); > >> > > + > >> > > + boolean suppressPasswordResetLink = > >> > > > >> > > >> > getConfiguration().getBoolean(WicketSignInPage.ISIS_VIEWER_WICKET_SUPPRESS_PASSWORD_RESET, > >> > > false); > >> > > + if(suppressPasswordResetLink) { > >> > > + throw new > >> > > RestartResponseAtInterceptPageException(WicketSignInPage.class); > >> > > > >> > > >> > This should use PageClassRegistry.get(PageType.SIGN_IN) instead, to > >> allow > >> > usage of custom sign in page impls. > >> > > >> > > >> > > + } > >> > > } > >> > > > >> > > @Override > >> > > > >> > > > >> > > > >> > > >> > http://git-wip-us.apache.org/repos/asf/isis/blob/1ca9c59d/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/signup/RegistrationFormPage.java > >> > > > ---------------------------------------------------------------------- > >> > > diff --git > >> > > > >> > > >> > a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/signup/RegistrationFormPage.java > >> > > > >> > > >> > b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/signup/RegistrationFormPage.java > >> > > index 6fd5338..242febe 100644 > >> > > --- > >> > > > >> > > >> > a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/signup/RegistrationFormPage.java > >> > > +++ > >> > > > >> > > >> > b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/signup/RegistrationFormPage.java > >> > > @@ -19,9 +19,11 @@ > >> > > > >> > > package org.apache.isis.viewer.wicket.ui.pages.accmngt.signup; > >> > > > >> > > +import org.apache.wicket.RestartResponseAtInterceptPageException; > >> > > import org.apache.wicket.request.mapper.parameter.PageParameters; > >> > > import org.apache.isis.viewer.wicket.ui.errors.ExceptionModel; > >> > > import > >> > > > >> > > >> > org.apache.isis.viewer.wicket.ui.pages.accmngt.AccountManagementPageAbstract; > >> > > +import > org.apache.isis.viewer.wicket.ui.pages.login.WicketSignInPage; > >> > > > >> > > /** > >> > > * A page for self-registering a new user after confirmation of her > >> > email > >> > > account. > >> > > @@ -36,6 +38,12 @@ public class RegistrationFormPage extends > >> > > AccountManagementPageAbstract { > >> > > > >> > > private RegistrationFormPage(final PageParameters parameters, > >> > > ExceptionModel exceptionModel) { > >> > > super(parameters, exceptionModel); > >> > > + > >> > > + boolean suppressSignUp = > >> > > > >> > > >> > getConfiguration().getBoolean(WicketSignInPage.ISIS_VIEWER_WICKET_SUPPRESS_SIGN_UP, > >> > > false); > >> > > + if(suppressSignUp) { > >> > > + throw new > >> > > RestartResponseAtInterceptPageException(WicketSignInPage.class); > >> > > > >> > > >> > ditto > >> > > >> > > >> > > + } > >> > > + > >> > > } > >> > > > >> > > @Override > >> > > > >> > > > >> > > > >> > > >> > http://git-wip-us.apache.org/repos/asf/isis/blob/1ca9c59d/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/login/WicketSignInPage.java > >> > > > ---------------------------------------------------------------------- > >> > > diff --git > >> > > > >> > > >> > a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/login/WicketSignInPage.java > >> > > > >> > > >> > b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/login/WicketSignInPage.java > >> > > index 9e0e5b3..b0de663 100644 > >> > > --- > >> > > > >> > > >> > a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/login/WicketSignInPage.java > >> > > +++ > >> > > > >> > > >> > b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/login/WicketSignInPage.java > >> > > @@ -30,9 +30,14 @@ import > >> > > > >> > org.apache.isis.viewer.wicket.ui.pages.accmngt.AccountManagementPageAbstr > >> > > * Boilerplate, pick up our HTML and CSS. > >> > > */ > >> > > public class WicketSignInPage extends > AccountManagementPageAbstract { > >> > > - > >> > > + > >> > > private static final long serialVersionUID = 1L; > >> > > > >> > > + public static final String > >> ISIS_VIEWER_WICKET_SUPPRESS_REMEMBER_ME = > >> > > "isis.viewer.wicket.suppressRememberMe"; > >> > > + public static final String ISIS_VIEWER_WICKET_SUPPRESS_SIGN_UP > = > >> > > "isis.viewer.wicket.suppressSignUp"; > >> > > + public static final String > >> > ISIS_VIEWER_WICKET_SUPPRESS_PASSWORD_RESET > >> > > = "isis.viewer.wicket.suppressPasswordReset"; > >> > > + public static final String > >> > > ISIS_VIEWER_WICKET_CLEAR_ORIGINAL_DESTINATION = > >> > > "isis.viewer.wicket.clearOriginalDestination"; > >> > > + > >> > > public WicketSignInPage(final PageParameters parameters) { > >> > > this(parameters, getAndClearExceptionModelIfAny()); > >> > > } > >> > > @@ -65,10 +70,10 @@ public class WicketSignInPage extends > >> > > AccountManagementPageAbstract { > >> > > } > >> > > > >> > > protected SignInPanel addSignInPanel() { > >> > > - final boolean suppressRememberMe = > >> > > > getConfiguration().getBoolean("isis.viewer.wicket.suppressRememberMe", > >> > > false); > >> > > - final boolean suppressSignUpLink = > >> > > getConfiguration().getBoolean("isis.viewer.wicket.suppressSignUp", > >> > false); > >> > > - final boolean suppressPasswordResetLink = > >> > > > >> > getConfiguration().getBoolean("isis.viewer.wicket.suppressPasswordReset", > >> > > false); > >> > > - final boolean clearOriginalDestination = > >> > > > >> > > >> > getConfiguration().getBoolean("isis.viewer.wicket.clearOriginalDestination", > >> > > false); > >> > > + final boolean suppressRememberMe = > >> > > > getConfiguration().getBoolean(ISIS_VIEWER_WICKET_SUPPRESS_REMEMBER_ME, > >> > > false); > >> > > + final boolean suppressSignUpLink = > >> > > getConfiguration().getBoolean(ISIS_VIEWER_WICKET_SUPPRESS_SIGN_UP, > >> > false); > >> > > + final boolean suppressPasswordResetLink = > >> > > > >> > getConfiguration().getBoolean(ISIS_VIEWER_WICKET_SUPPRESS_PASSWORD_RESET, > >> > > false); > >> > > + final boolean clearOriginalDestination = > >> > > > >> > > >> > getConfiguration().getBoolean(ISIS_VIEWER_WICKET_CLEAR_ORIGINAL_DESTINATION, > >> > > false); > >> > > final boolean rememberMe = !suppressRememberMe; > >> > > final boolean signUpLink = !suppressSignUpLink; > >> > > final boolean passwordReset = !suppressPasswordResetLink; > >> > > > >> > > > >> > > >> > > > > >
