mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Move 'Auth.redirect' session value clearing from AuthComponent::shutdown() to prevent unnecessary session start.
Closes #3702
This commit is contained in:
parent
0900c32c03
commit
8e299fc404
2 changed files with 2 additions and 27 deletions
|
@ -680,6 +680,7 @@ class AuthComponent extends Component {
|
|||
|
||||
$user = $this->user();
|
||||
if ($user) {
|
||||
$this->Session->delete('Auth.redirect');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -791,18 +792,6 @@ class AuthComponent extends Component {
|
|||
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 @@ class AuthComponentTest extends CakeTestCase {
|
|||
$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
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue