Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Auth Component does not logout via URL
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Prof. No Time  
View profile  
 More options Nov 2, 2:03 pm
From: "Prof. No Time" <libertylivingst...@gmail.com>
Date: Sun, 1 Nov 2009 19:03:50 -0800 (PST)
Local: Mon, Nov 2 2009 2:03 pm
Subject: Auth Component does not logout via URL
Good day all,

Please, I have a little problem with my AUTH component. I am using the
default AUTH component in 1.2.5. I discovered that when I login to my
app and then try to log  out by typing the logout url: http://localhost/myapp/logout
(which is routed to myapp/users/logout), the auth component simply
refuses to logout (instead it gives me the deny message: You are not
authorized to bla bla bla...). It also presents me with the login form
to authorize me. The funniest part is that if I then enter my
credentials, I am then logged out. (Imagine entering username and
password to log out of an application, isn't that sickening?)

However, when I click on logout link from within a page, it logs out
correctly. What could be the cause of this?


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
robustsolution  
View profile  
 More options Nov 3, 1:29 am
From: robustsolution <i...@robustsolution.net>
Date: Mon, 2 Nov 2009 06:29:45 -0800 (PST)
Local: Tues, Nov 3 2009 1:29 am
Subject: Re: Auth Component does not logout via URL
Prof.No Time

try to take a coffee cup and get relaxed, this is my current solution/
tips/tricks for the moment

1)put this in your AppController class
final protected function _logout() {
        if (!empty($this->Cookie)) {
                //this ensures if you were using the Cookie component along with the
Auth component (the famous remember me checkbox)
                //and you have saved the credentials inside cookie
                //you should delete the credentials from the cookie when you log out
                //no need to verify if you have already saved the credentials inside
cookie, no error is thrown
                $this->Cookie->del($this->Auth->sessionKey);
        }
        return $this->Auth->logout();

}

2)your UsersController class logout() method should be now like this
public function logout() {
        $this->redirect($this->_logout());

}

3)your UsersController class beforeFilter() method/callback should be
now like this
public function beforeFilter() {
        ...
        parent::beforeFilter();
        //please specify the always allowed actions... logout should be the
first one of course
        $this->Auth->allow
('logout','forgotpassword','resetpassword','activate','register'/* put
here any other always-allowed action*/);
        if ($this->Auth->user()) {
                if (in_array($this->params['action'],array
('forgotpassword','resetpassword','register','activate'))) {
                        //if you are forgetting your password,
                        //if you resetting your password,
                        //if you are registering as a new user,
                        //or if you are activating you new accout via url
                        //you should not be logged in ... yea this is logic
                        $this->_logout();
                } elseif($this->params['action']=='login') {
                        //you are already logged in, no need to login again
                        $this->redirect($this->Auth->redirect());
                }
        } elseif ($this->params['action']=='logout') {
                //you are already logged out, no need to log out again
                $this->redirect($this->Auth->redirect());
        }
        ...

}

now have a nice baking day....

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Prof. No Time  
View profile  
 More options Nov 5, 2:40 am
From: "Prof. No Time" <libertylivingst...@gmail.com>
Date: Wed, 4 Nov 2009 07:40:24 -0800 (PST)
Local: Thurs, Nov 5 2009 2:40 am
Subject: Re: Auth Component does not logout via URL
Thanks very very much RobustSolution, I have applied your logic. Its
ok though I didn't use the "famous" remember me here checkbox. I have
studied the issue and finally discovered that it is a fault of the
BUGGY INTERNET EXPLORER that keeps CACHING the page instead of
visiting the SERVER for proper details (Stupid Explorer!!!). Please
can you help me out on how to prevent caching of the LOGOUT page by
such browsers?

Cheers in ADV.

On Nov 2, 3:29 pm, robustsolution <i...@robustsolution.net> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
robustsolution  
View profile  
 More options Nov 6, 9:51 am
From: robustsolution <i...@robustsolution.net>
Date: Thu, 5 Nov 2009 14:51:00 -0800 (PST)
Subject: Re: Auth Component does not logout via URL
m really sorry for the delay but I really misunderstood the question

I don't know if you mean this

http://book.cakephp.org/view/431/disableCache

On Nov 4, 3:40 pm, "Prof. No Time" <libertylivingst...@gmail.com>
wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google