On Sat, May 23, 2009 at 6:22 PM, Jeppe Nejsum Madsen <je...@ingolfs.dk> wrote:
> Hi.
>
> I want to protect all pages in the app (except login :-) so if you try
> to access a page, you get to the login page and after successful
> login, you get redirected back to the requested page. I'm combining
> the ideas from
[...]

> It seems the problems are caused by an empty referrer as seen in the
> logs below. This makes sense since the original request to "/" doesn't
> contain a referer, the redirect doesn't either.
>
> So the question is: is there a better way to capture the original page
> the user was requesting? Since the redirect happens in the
> EarlyResponse I was wondering if it was possible to just tack it on as
> a parameter in the RedirectReponse. But is there a better way?

Reply to self: This seems to work:

 override def login = {
    for {r <- S.request
         ret <- r.param("returnTo") if loginReferer.is == "/"}
        loginReferer.set(ret)
    super.login
  }

 val loggedIn = Loc.EarlyResponse(
          () =>
Full(RedirectResponse("/profile//login?returnTo="+S.uri)).filter(ignore
=> !User.loggedIn_?))

/Jeppe

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to