On Thursday, July 6, 2017 at 12:41:23 PM UTC-4, Pierre wrote: > > can't find an easy way out of this.... > > so far i have : > > auth.settings.login_next = URL('controller','dosomething') > > > but this works only with direct login via top navbar button, not when > login occurs via decorated controller function > : > @auth.requires_login() > def func(): > pass >
auth.settings.login_next is used only as a default when there is no _next variable in the query string -- otherwise, _next takes precedence. However, @auth.requires_login() will by default add a _next variable to the query string when it redirects to the login action. To avoid this, you have two options: @auth.requires_login(otherwise=auth.settings.login_next) "otherwise" can also be a callable object, which can return a URL or itself do a redirect. Alternatively, in the user() action, you can simply delete the _next variable before processing the Auth request: def user(): if request.args(0) == 'login' and '_next' in request.get_vars: del request.get_vars._next return dict(form=auth()) Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.