Updated Branches: refs/heads/master 266ca764d -> cd632a5bf
WICKET-4115 let subclasses decide what to do when sign-in was remembered Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/cd632a5b Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/cd632a5b Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/cd632a5b Branch: refs/heads/master Commit: cd632a5bfc2e5e842b791b49bb44d268c60fbc1e Parents: 266ca76 Author: svenmeier <[email protected]> Authored: Thu Feb 21 16:08:09 2013 +0100 Committer: svenmeier <[email protected]> Committed: Thu Feb 21 16:10:42 2013 +0100 ---------------------------------------------------------------------- .../authentication/panel/SignInPanel.java | 35 +++++++++++---- 1 files changed, 26 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/cd632a5b/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/panel/SignInPanel.java ---------------------------------------------------------------------- diff --git a/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/panel/SignInPanel.java b/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/panel/SignInPanel.java index e0cb708..14a3e18 100644 --- a/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/panel/SignInPanel.java +++ b/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/panel/SignInPanel.java @@ -108,10 +108,12 @@ public class SignInPanel extends Panel } /** - * @see org.apache.wicket.Component#onBeforeRender() + * Try to sign-in with remembered credentials. + * + * @see #setRememberMe(boolean) */ @Override - protected void onBeforeRender() + protected void onConfigure() { // logged in already? if (isSignedIn() == false) @@ -129,11 +131,7 @@ public class SignInPanel extends Panel username = data[0]; password = data[1]; - // logon successful. Continue to the original destination - continueToOriginalDestination(); - // Ups, no original destination. Go to the home page - throw new RestartResponseException(getSession().getPageFactory().newPage( - getApplication().getHomePage())); + onSignInRemembered(); } else { @@ -143,8 +141,7 @@ public class SignInPanel extends Panel } } - // don't forget - super.onBeforeRender(); + super.onConfigure(); } /** @@ -251,6 +248,26 @@ public class SignInPanel extends Panel } /** + * Called when sign-in was remembered. + * <p> + * By default tries to continue to the original destination or switches to the application's + * home page. + * <p> + * Note: This method will be called during rendering of this panel, thus a + * {@link RestartResponseException} has to be used to switch to a different page. + * + * @see #onConfigure() + */ + protected void onSignInRemembered() + { + // logon successful. Continue to the original destination + continueToOriginalDestination(); + + // Ups, no original destination. Go to the home page + throw new RestartResponseException(getApplication().getHomePage()); + } + + /** * Sign in form. */ public final class SignInForm extends StatelessForm<SignInPanel>
