Are you saying if someone attempts to visit foo when they are not logged 
in, you want them to be directed to login, but then you *don't* want them 
to be redirected back to foo after the login? Why not? Why make them log in 
for foo if you're not going to take them back to foo after login?

Anthony

On Wednesday, March 30, 2016 at 9:55:12 AM UTC-4, killzane wrote:
>
> Thanks about explain it.
>
> this is code in my controller "default.py"
>
> @auth.required_login()
> def foo():
>     return 'this requires login' 
>
> I use these code for visitor auto redirect to login page.
> and web2py will auto add *_next* variable then I can't use 
> *auth.settings.login_next 
> *to redirect location.
> so how to let web2py *don't *auto add _next variable by use 
> @auth.required_login()? 
>
> Anthony於 2016年3月30日星期三 UTC+8下午8時54分30秒寫道:
>>
>> On Wednesday, March 30, 2016 at 4:06:41 AM UTC-4, killzane wrote:
>>>
>>> I use *@auth.requires_login()* in my controller
>>> and when I visit that page, I will auto go to login page and have the 
>>> "_next URL parameter"
>>>
>>> I want to use 
>>> auth.settings.login_next = URL('default', 'router')
>>>
>>> according to this page 
>>> <http://web2py.com/books/default/chapter/29/09/access-control#Auth-Settings-and-messages>
>>>  I 
>>> need to set *referrer_actions *but I don't know where should I put this 
>>> code?
>>> or It has other way to do it?
>>>
>>
>> auth.settings.login_next is the default redirect location in case there 
>> is *no* _next variable in the URL query string -- so that should already 
>> work without any _next variable. By default, the auth.navbar adds a _next 
>> variable to the login URL when the login link is clicked (so the user will 
>> be redirected back to the page they were on before logging in) -- the _next 
>> variable in the URL takes precedence over the auth.settings.login_next 
>> setting, which only serves as a default. If you want to prevent auth.navbar 
>> from adding the _next variable, you can use auth.navbar(..., 
>> referrer_actions=None) wherever you have inserted the navbar (most likely 
>> this would be in your layout.html). If that is not your goal, please 
>> explain the behavior you are looking for and what you are seeing instead.
>>
>> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to