Hi,

I had done tests using a new empty application and this works. 
My current application uses a customdb auth table and its using 

auth.settings.on_failed_authentication = lambda url: redirect(url)


but with custom tables settings do not apply.


Regards,



El jueves, 22 de agosto de 2019, 19:01:04 (UTC-5), Dave S escribió:
>
> On Thursday, August 22, 2019 at 4:32:02 PM UTC-7, Patito Feo wrote:
>>
>> Hi,
>>
>> This does not worked.
>> Redirecting still goes to user/login.html.
>>
>> Any ideas?
>>
>> Cheers,
>>
>
>
> For a little more context, here's a larger quote form the book:
>
> 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.
>>
>
>
> from <URL:
> http://web2py.com/books/default/chapter/29/09/access-control#Auth-Settings-and-messages
> >
>
> Good luck!
>
> /dps
>  
>
>>
>> El jueves, 22 de agosto de 2019, 0:44:39 (UTC-5), Annet escribió:
>>>
>>> What about:
>>>
>>> auth.settings.on_failed_authentication = lambda url: redirect(url)
>>>
>>>
>>> That is what the book says changing the default behaviour.
>>>
>>>
>>> Kind regards,
>>>
>>> Annet
>>>
>>>
>>>
>>>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/547cb1b3-0856-4dce-93d0-42340edf13fa%40googlegroups.com.

Reply via email to