Are you entering the URL of your main page or your login page?

You also have to check if there is a continue-to-destination field set and
if not you have to send your user to a default home page.

N
On Oct 2, 2013 8:18 PM, "shimin_q" <smq...@hotmail.com> wrote:

> Thanks - that sounds exactly what I observed in my case where the login
> page
> (HomePage class) gets redisplayed after I entered the user name and
> password.
>
> I am looking at some sample code with Stateless login forms, in addition to
> using StatelessForm instead Form, a bind() is called too after
> authenticate().  So I changed my LoginForm as follows (note that LoginForm
> is part of my HomePage class):
>
> public class LoginForm extends StatelessForm<Login> {
>
>         private static final Logger logger =
>                         LoggerFactory.getLogger(LoginForm.class);
>
>         private static final long serialVersionUID = 1L;
>
>         private TextField<String> username;
>         private PasswordTextField password;
>
>         public LoginForm(String id) {
>                 super(id, new CompoundPropertyModel<Login>(new Login()));
>
>                 username = new TextField<String>("username");
>                 username.setRequired(true);
>                 add(username);
>                 password = new PasswordTextField("password");
>                 add(password);
>         }
>
>         @Override
>         protected void onSubmit() {
>                 Login login = getModelObject();
>
>                 AuthenticatedWebSession session =
> AuthenticatedWebSession.get();
>                 if(session instanceof AwolAuthenticatedWebSession) {
>                         logger.debug("session is
> AwolAuthenticatedWebSession");
>                 }
>                 if (session.authenticate(login.getUsername(),
> login.getPassword())) {
>                         logger.debug("authentication successful");
>                         if (session.isTemporary()) {
>                                 logger.debug("session temporary, bind to
> permanent");
>                                 session.bind();  // according to sample
> code, this makes the temporary
> session used by the stateless login page permanent
>                         }
>
>                         this.continueToOriginalDestination();
>                 }
>                 else {
>                         error("Invalid credentials");
>                 }
>         }
>
> But this code change does not seem to work either.  The first time I log
> in,
> the session.isTemporary returns true, so it did session.bind().  But after
> continueToOriginalDestination(), it is still the login page displayed, it
> does not go on to MainPage.  If I enter username/password again, this time,
> the code seems to get a session.isTemporary returns false, and
> continueToOriginalDestination() still does not go on to MainPage.
>
> Anything else I am missing here?  Thanks for your help!
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654p4661667.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to