You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Neil Curzon <ne...@gmail.com> on 2009/05/20 17:50:47 UTC

Login page expired

Hi all,

I'm having an issue with sitting on the login page for a while before
entering credentials. You get a Page Expired if you submit after waiting too
long, and I think this will confuse my users. Especially since I was
planning on setting my custom expired page to the Login.

Some googling lead me to StatelessForm which sounded like it would solve my
problem. However, after I use it, I find I can actually never log in
successfully. For now, I just set a boolean in the session if the
credentials match. My debugging output indicates that the boolean is being
set to true. Here's the form's onSubmit.

        @Override
        protected void onSubmit() {
            if (loginIsValid()) {
                System.out.println("Yep, I'm setting logged in to true");
                MySession session = MySession.get();
                session.setLoggedIn(true);
                setRedirect(true);
                setResponsePage(AdminIndex.class);
            } else {
                System.out.println("NO GOOD");
                error("Invalid user and/or password");
            }
        }

However, I also put a debug message before my newSession method in my
Application, and it seems that a new session is created for every request,
including the redirect after successful login. This results in my base page
class detecting that the user isn't logged in and redirecting back to the
Login page. Everything works fine if I change the StatelessForm back to
Form.

Is there some way I could fix this StatelessForm? Or is there some better
way to get the login form to never give a page expired?

Thanks
Neil

Re: Login page expired

Posted by Neil Curzon <ne...@gmail.com>.
Hi Jeremy,

Thanks for your reply. Adding a session.bind() solved the issue.

Neil

On Wed, May 20, 2009 at 12:03 PM, Jeremy Thomerson <
jeremy@wickettraining.com> wrote:

> If you're in the stateless form's onsubmit and you redirect to a
> stateless page, you may need to call session.bind so that it knows
> that you need the session to be persistent.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
>
> On Wed, May 20, 2009 at 10:50 AM, Neil Curzon <ne...@gmail.com>
> wrote:
> > Hi all,
> >
> > I'm having an issue with sitting on the login page for a while before
> > entering credentials. You get a Page Expired if you submit after waiting
> too
> > long, and I think this will confuse my users. Especially since I was
> > planning on setting my custom expired page to the Login.
> >
> > Some googling lead me to StatelessForm which sounded like it would solve
> my
> > problem. However, after I use it, I find I can actually never log in
> > successfully. For now, I just set a boolean in the session if the
> > credentials match. My debugging output indicates that the boolean is
> being
> > set to true. Here's the form's onSubmit.
> >
> >        @Override
> >        protected void onSubmit() {
> >            if (loginIsValid()) {
> >                System.out.println("Yep, I'm setting logged in to true");
> >                MySession session = MySession.get();
> >                session.setLoggedIn(true);
> >                setRedirect(true);
> >                setResponsePage(AdminIndex.class);
> >            } else {
> >                System.out.println("NO GOOD");
> >                error("Invalid user and/or password");
> >            }
> >        }
> >
> > However, I also put a debug message before my newSession method in my
> > Application, and it seems that a new session is created for every
> request,
> > including the redirect after successful login. This results in my base
> page
> > class detecting that the user isn't logged in and redirecting back to the
> > Login page. Everything works fine if I change the StatelessForm back to
> > Form.
> >
> > Is there some way I could fix this StatelessForm? Or is there some better
> > way to get the login form to never give a page expired?
> >
> > Thanks
> > Neil
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Login page expired

Posted by Jeremy Thomerson <je...@wickettraining.com>.
If you're in the stateless form's onsubmit and you redirect to a
stateless page, you may need to call session.bind so that it knows
that you need the session to be persistent.

--
Jeremy Thomerson
http://www.wickettraining.com




On Wed, May 20, 2009 at 10:50 AM, Neil Curzon <ne...@gmail.com> wrote:
> Hi all,
>
> I'm having an issue with sitting on the login page for a while before
> entering credentials. You get a Page Expired if you submit after waiting too
> long, and I think this will confuse my users. Especially since I was
> planning on setting my custom expired page to the Login.
>
> Some googling lead me to StatelessForm which sounded like it would solve my
> problem. However, after I use it, I find I can actually never log in
> successfully. For now, I just set a boolean in the session if the
> credentials match. My debugging output indicates that the boolean is being
> set to true. Here's the form's onSubmit.
>
>        @Override
>        protected void onSubmit() {
>            if (loginIsValid()) {
>                System.out.println("Yep, I'm setting logged in to true");
>                MySession session = MySession.get();
>                session.setLoggedIn(true);
>                setRedirect(true);
>                setResponsePage(AdminIndex.class);
>            } else {
>                System.out.println("NO GOOD");
>                error("Invalid user and/or password");
>            }
>        }
>
> However, I also put a debug message before my newSession method in my
> Application, and it seems that a new session is created for every request,
> including the redirect after successful login. This results in my base page
> class detecting that the user isn't logged in and redirecting back to the
> Login page. Everything works fine if I change the StatelessForm back to
> Form.
>
> Is there some way I could fix this StatelessForm? Or is there some better
> way to get the login form to never give a page expired?
>
> Thanks
> Neil
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org