If you add a '_next' variable to your login link, the user will be
redirected to the URL in the '_next' variable after login. So, wherever you
are setting your login link, do something like this:
<a href="{{=URL('default', 'user', args='login',
vars=dict(_next=URL(r=request, args=request.args,
vars=request.vars)))}}">login</a>
If you're using the default auth.navbar() to generate your login link, it's
a little trickier -- you'll have to tweak the login link created by the
navbar() method:
{{navbar=auth.navbar()}}
{{login_link=navbar.elements('a')[0]}}
{{login_link['_href']='%s?_next=%s' % (login_link['_href'],
URL(r=request, args=request.args, vars=request.vars))}}
{{=navbar}}
Anthony
On Monday, June 27, 2011 8:34:09 AM UTC-4, wdtatenh wrote:
> I'm building an application that uses the login features provided by
> web2py. Users could login at any time so I was hoping for a solution
> that would take the person to the last page they were on before they
> logged in instead of going to the index page. Any suggestions would
> be greatly appreciated.
>
> Thanks in advance