auth.settings.on_failed_authentication = lambda url: redirect(url)
Hi,This does not worked.Redirecting still goes to user/login.html.Any ideas?Cheers,
If the visitor is not logger in, and calls a function that requires authentication, the user is redirected to auth.settings.login_url which defaults to URL('default', 'user/login'). One can replace this behavior by redefining:
auth.settings.on_failed_authentication = lambda url: redirect(url)
This is the function called for the redirection. The argument url` passed to this function is the url for the login page.
If the visitor does not have permission to access a given function, the visitor is redirect to the URL defined by
auth.settings.on_failed_authorization = URL('user', args='on_failed_authorization')
You can change this variable and redirect the user elsewhere.
Often on_failed_authorization is a URL but it can be a function that returns the URL and it will be called on failed authorization.
auth.settings.on_failed_authentication = lambda url: redirect(url)