[Lift] Re: Redirect after login

2009-06-16 Thread Alexander Azarov
David, Glenn, Many thanks to the thread, I realized how to redirect a user the page he/she was going to load after his/her logon. In this case, I believe it's better to re-implement usual IfLoggedIn (instead of overriding User.login): lazy val IfLoggedIn = If(User.loggedIn_? _, loginAndComeBack

[Lift] Re: Redirect after login

2009-05-19 Thread glenn
David, Just a quick followup, this code actually does what I want, although I still have yet to reset the loginReferer SessionVar back to the default. override def homePage = { var ret = loginReferer.is loginReferer.substring(loginReferer.toString.lastIndexOf('/') + 1) match {

[Lift] Re: Redirect after login

2009-05-19 Thread glenn
David, I'm sorry too, because I was already using loginReferer.is. The problem is the loginReferer.remove line has to be removed for the redirect to work. Don't know why. You would think the ret var would stay put, but it doesn't. Glenn... On May 18, 3:57 pm, David Pollak wrote: > Glenn, > >

[Lift] Re: Redirect after login

2009-05-18 Thread David Pollak
Glenn, Sorry... my mistake... the following code works: object loginReferer extends SessionVar("/") override def homePage = { var ret = loginReferer.*is* loginReferer.remove() ret } override def login = { for (r <- S.referer if loginReferer.is == "/") loginReferer.set(r)

[Lift] Re: Redirect after login

2009-05-17 Thread glenn
David, I was a little puzzled by the line, in the override of def homePage, of loginReferer.remove(). This actually resets the homePage to "/". Removing the line has the intended result. But, then I need a way to reset the loginReferer session variable. Better still, it would be nice to be able

[Lift] Re: Redirect after login

2009-05-15 Thread David Pollak
In your User object, do the following: object loginReferer extends SessionVar("/") override def homePage = { var ret = loginReferer loginReferer.remove() ret } override def login = { for (r <- S.referer if loginReferer.is == "/") loginReferer.set(r) super.login } So, we're setting up

[Lift] Re: Redirect after login

2009-05-15 Thread glenn
I'm using ProtoUser. But even so, I thought that I might have to create a bunch of separate login pages, each using the loginXhtml form so that action={S.uri} would generate the links to match with the cases. In that way I could do the redirection. But that seems convoluted, to me. This goes back

[Lift] Re: Redirect after login

2009-05-15 Thread David Pollak
On your login page, you can capture the referer and then redirect to the refering page on successful login. Are you using ProtoUser or are you rolling your own login page? On Fri, May 15, 2009 at 1:27 PM, glenn wrote: > > If I wanted to redirect the user to a different page, depending on > what