Permalink
Browse files

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

…own() to prevent unnecessary session start.


Closes #3702
  • Loading branch information...
1 parent 0900c32 commit 8e299fc404811ce2e06613d958dd7461661aefeb @ADmad ADmad committed Mar 14, 2013
@@ -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;
@@ -791,18 +792,6 @@ public static function password($password) {
return Security::hash($password, null, true);
}
-/**
- * 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.
*
@@ -1108,20 +1108,6 @@ public function testStatelessAuthWorksWithUser() {
$this->assertEquals('mariano', $result);
}
-/**
- * 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
*

0 comments on commit 8e299fc

Please sign in to comment.