You can probably start with the Auth.requires() decorator and modify as 
needed: https://github.com/web2py/web2py/blob/master/gluon/tools.py#L3201

Anthony

On Thursday, December 19, 2013 9:07:10 AM UTC-5, Leonel Câmara wrote:
>
> http://www.artima.com/weblogs/viewpost.jsp?thread=240808
>
> Terça-feira, 17 de Dezembro de 2013 6:23:23 UTC, software.ted escreveu:
>>
>> I am trying to create an application using web2py backend that is fully 
>> AJAX. I amusing the jQuery/Javascript to create a client. Now am a bit 
>> stuck on the customising the behavior @auth.requires_login() decorator.
>>
>> I have a jQuery request to an action with a @auth.requires_login() 
>> decorator:
>>
>> Client
>>
>> function(){
>>      $('#div').load('{{"default","getPrice"}}');
>> }
>>
>>
>> web2py control
>>
>> @auth.requires_login()
>> def getPrice():
>>     ...
>>     ...
>>     return locals()
>>
>> At the moment when i capture what is returned when not logged in is the 
>> following text:
>>
>> <div class="not-authorized alert alert-block"><h4>NOT 
>> AUTHORIZED</h4>Please <a data-w2p_disable_with="default" href="">login</a> 
>> to view this content.</div>
>>
>> How can I return say forinstance true or false , logged in or logged 
>> out...or redirect to an action that returns and invokes a jQuery login 
>> window??
>>
>> Thanx in advance
>>
>>
>>
>>
>>
>> -- 
>>
>> .......................................................................................
>> Teddy Lubasi Nyambe
>> Opensource Zambia
>> Lusaka, ZAMBIA
>>
>> Cell: +260 97 7760473
>> website: http://www.opensource.org.zm
>>
>> ~/
>> Human Knowledge belongs to the world! - AntiTrust
>>
>> Man is a tool-using animal. Without tools he is nothing, with tools he is 
>> all - Thomas Carlyle 1795-1881
>>
>> /~ 
>>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to