Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move 'Auth.redirect' session value clearing from AuthComponent::shutd…

…own() to prevent unnecessary session start.

Closes #3702
  • Loading branch information...
commit 8e299fc404811ce2e06613d958dd7461661aefeb 1 parent 0900c32
@ADmad ADmad authored
View
15 lib/Cake/Controller/Component/AuthComponent.php
@@ -608,7 +608,7 @@ public function login($user = null) {
}
/**
- * Log a user out.
+ * Log a user out.
*
* Returns the login action to redirect to. Triggers the logout() method of
* all the authenticate objects, so they can perform custom logout logic.
@@ -680,6 +680,7 @@ protected function _getUser() {
$user = $this->user();
if ($user) {
+ $this->Session->delete('Auth.redirect');
return true;
}
return false;
@@ -792,18 +793,6 @@ public static function password($password) {
}
/**
- * Component shutdown. If user is logged in, wipe out redirect.
- *
- * @param Controller $controller Instantiating controller
- * @return void
- */
- public function shutdown(Controller $controller) {
- if ($this->loggedIn()) {
- $this->Session->delete('Auth.redirect');
- }
- }
-
-/**
* Check whether or not the current user has data in the session, and is considered logged in.
*
* @return boolean true if the user is logged in, false otherwise
View
14 lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
@@ -1109,20 +1109,6 @@ public function testStatelessAuthWorksWithUser() {
}
/**
- * Tests that shutdown destroys the redirect session var
- *
- * @return void
- */
- public function testShutDown() {
- $this->Auth->Session->write('Auth.User', 'not empty');
- $this->Auth->Session->write('Auth.redirect', 'foo');
- $this->Controller->Auth->loggedIn(true);
-
- $this->Controller->Auth->shutdown($this->Controller);
- $this->assertNull($this->Auth->Session->read('Auth.redirect'));
- }
-
-/**
* test $settings in Controller::$components
*
* @return void
Please sign in to comment.
Something went wrong with that request. Please try again.