Thanks! As an aside, I wonder why redirecting to the last accessed controller function after login isn't the default behavior. Isn't this by far the most common use case?
On Feb 3, 2:25 pm, Wes James <[email protected]> wrote: > You will want to do it in your controller for each view function you have. > > I have some like this: > > if auth.is_logged_in(): > redirect(URL(r=request,c='default',f='apage')) > > or something like > > @auth.requires_login() > def change_password(): > return > dict(form=auth.change_password(next=URL(r=request,c='default',f='apage'))) > > db.py is used to set default behavior > > i.e.: > > auth.settings.register_next = URL(r=request,c='default',f='apage') > auth.settings.login_next = URL(r=request,c='default',f='apage') > auth.settings.logout_next = URL(r=request,c='default',f='apage') > > look in gluon/tools.py to see what the defaults are for many things. > > -wes > > On Wed, Feb 3, 2010 at 12:08 PM, Dane <[email protected]> wrote: > > Thanks, but I still don't understand.. if I set it in db.py, won't > > that permanently send all my login redirects to the same function? But > > I want the redirect to change depending on the part of the site my > > users try to access. Do I use a property on request for this? > > > On Feb 3, 1:53 pm, Wes James <[email protected]> wrote: > >> db.py > > >> On Wed, Feb 3, 2010 at 11:12 AM, Dane <[email protected]> wrote: > >> > Thanks, and where would I set this to get a redirect to the function > >> > being accessed? In the body of the controller function itself? I'm new > >> > to python and decorators, but I assumed nothing in the decorated > >> > function would run. > > >> > On Feb 3, 10:37 am, mdipierro <[email protected]> wrote: > >> >> auth.settings.login_next = URL(...) > > >> >> On Feb 3, 12:03 am, Dane <[email protected]> wrote: > > >> >> > Hey all, I've been using the @auth.requires_login() decorator and I > >> >> > love the simplicity. It was also pretty easily to hook it into google > >> >> > account authentication after a bit of searching on this group. My only > >> >> > problem with it is I don't want users redirected to the index after > >> >> > logging in, I'd like them to be redirected to the decorated controller > >> >> > function they initially tried to access. Any ideas? Thanks. > > >> >> > -Dane > > >> > -- > >> > You received this message because you are subscribed to the Google > >> > Groups "web2py-users" group. > >> > To post to this group, send email to [email protected]. > >> > To unsubscribe from this group, send email to > >> > [email protected]. > >> > For more options, visit this group > >> > athttp://groups.google.com/group/web2py?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "web2py-users" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group > > athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.

