Hi!
As I understand *requires() * designed to decorate and *back* redirection
after login, so it ignores *auth.settings.login_next *
If you want to redirect after login just do it from your *check_condition()*
directly
On Thursday, May 26, 2016 at 5:15:15 PM UTC+3, 黄祥 wrote:
>
> follow the instruction is working well, thank you, but when i tried to add
> the condition it didn't work.
> e.g.
> *controllers/default.py*
> *"""*
> *not work because of this*
> *def check_condition(): *
> * auth.settings.login_next = URL('user/profile')*
>
> *if request.function != 'user':*
> * auth.requires_login()(lambda: check_condition() )()*
> * #auth.settings.login_next = URL('user/profile')*
> *"""*
>
> def user():
> return dict(form=auth())
>
> any idea how to achieve it using web2py way?
>
> thanks and best regards,
> stifan
>
> On Monday, November 10, 2014 at 11:10:14 AM UTC+7, WhoSoLovesUs wrote:
>>
>> PS
>>
>> ... Glad to find this though at least, and thank you to everyone involved
>> in the thread!
>>
>> I am a beginning user, and I'm starting at the beginning of my app's most
>> fundamental needs (in this case of course, logging in, and what a user will
>> see when they do so)
>>
>>
>> On Thursday, December 6, 2012 7:06:14 AM UTC-8, Kostas M wrote:
>>>
>>> Peter, I agree with you 100% regarding the ambiguous documentation, and
>>> the lost time back and forth, among google searches and source code
>>> reading... I am one of them!
>>>
>>> Kostas
>>>
>>>
>>>
>>>> 'These must point to the URL you want to redirect your users to after
>>>> the various possible auth actions (in case there is no referrer): '
>>>>
>>>> This is an example of documentation that can only be understood by the
>>>> person who wrote it, or other people who already know the answer.
>>>>
>>>> I expect everyone new to this expects setting
>>>> auth.setting.register_next to a URL will cause the redirection. They all
>>>> then find out the hard way it does not work. Trawl through the forums and
>>>> try various things until coming up with a solution. I wonder how much time
>>>> has been wasted on this (and the login_next etc).
>>>>
>>>> Peter
>>>>
>>>>>
>>>>>
--
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.