Hi Massimo, 
   
     Thanks for the reply, but sorry to say this, but I didn't understand 
what you meant there, which function should have both. I wanted every user 
to have login and logout functions, thats why I didn't add auth.permission 
for them.   And can you explain why it is giving 303 error. Is it something 
with the redirect(next).

On Thursday, 13 February 2014 18:16:27 UTC+5:30, ajith c t wrote:
>
>
> Hi ,
>   I am using web2py 2.5.1-stable+timestamp.2013.06.06.15.39.19 in my 
> production environment. I know it is old but thinking about the mysql and 
> other folders and files structure changes I am little hesitant to update 
> it. My problem is this.
>
> My logout function doesn't work properly.  
>
> # Login function
> def login():
>   
>   try:  
>         logger.debug("login page")
>         form = auth.login()
>         return dict(form = form)
>
>   except Exception,e:
>         logger.error(traceback.format_exc())
>         redirect(URL(errorpage))
>
> @auth.requires_login()
> def index():
>
>     try:
>         if auth.has_membership('root'):
>             logger.debug(auth.user.first_name + ": logged in")
>             redirect(URL('default', 'usrMgr'))     
>         else:
>             logger.debug(auth.user.first_name +": logged in")   
>
>         redirect(URL('dashboard'))    
>         
>     except Exception,e:
>         logger.error(traceback.format_exc())
>         redirect(URL(errorpage))
>
> @auth.requires_login()
> @auth.requires_permission(request.function)
> def dashboard():
>
>       try:
>             logger.info("dashboard")
>             ###Some Code#######
>       except Exception,e:
>             logger.error(traceback.format_exc())
>             redirect(URL(errorpage))
>
>  def logout():
>  
>    try:
>          logger.debug("logout")
>          auth.logout(next=URL(r=request, c='default', f='login'))
>          return dict()
>    except Exception,e:
>          logger.error(traceback.format_exc())
>          redirect(URL(errorpage))
>
>
> The behavior is different in different browsers. In Chrome when I select 
> logout from the dashboard page, it remains in the same page. When I select 
> the developer tools and check the network the urls are logout, login, 
> dashboard in order and its loaded from cache. But there is no problem in 
> firefox.
>
> My problem is the logut function doesnt redirect to login page. When I 
> clear the browser cache or delete all the sessions in the sessions folder, 
> it works neatly. But when the session file or the cache gets filled up, 
> everything goes wrong.  Let me know if I wasn't specific, so I can clear 
> this problem.
>
> Thanks and Regards,
>
> Ajith
>

-- 
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/groups/opt_out.

Reply via email to