How to do I stop auth.requires_login() from redirecting to the default/user controller?

48 views
Skip to first unread message

Melody Daniel

unread,
May 10, 2019, 10:00:10 AM5/10/19
to web2py-users
My app consists of two sides, the public side(default/index) accessible to anyone from anywhere and the private side(admin/index) accessible to only administrators. I moved the function responsible for authentication from the 'default.py' controller to the 'admin.py' as the public side requires no authorization to access but when I use the 
auth.requires_login()
decorator on the admin side the user gets redirected to 'default/user/login' which no longer exist. please how can I make the authentication redirect to 'admin/user' instead?

Leonel Câmara

unread,
May 10, 2019, 1:55:40 PM5/10/19
to web2py-users
You need to set login_url

auth.settings.login_url = URL(YOUR_NEW_CONTROLLER, YOUR_NEW_FUNCTION)

Leonel Câmara

unread,
May 10, 2019, 2:13:06 PM5/10/19
to web2py-users
Also you probably want to change these as well

auth.settings.verify_email_next
auth.settings.request_reset_password_next

Patito Feo

unread,
Aug 7, 2019, 11:03:16 AM8/7/19
to web2py-users
Hi,

This is not working.
Neither is this 

auth.settings.on_failed_authentication


Any ideas?
Reply all
Reply to author
Forward
0 new messages