mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Avoid unnecessary overhead if user record already available from session.
This commit is contained in:
parent
06a5c509c0
commit
3db632732c
2 changed files with 7 additions and 5 deletions
|
@ -667,6 +667,12 @@ class AuthComponent extends Component {
|
|||
* @return boolean true if a user can be found, false if one cannot.
|
||||
*/
|
||||
protected function _getUser() {
|
||||
$user = $this->user();
|
||||
if ($user) {
|
||||
$this->Session->delete('Auth.redirect');
|
||||
return true;
|
||||
}
|
||||
|
||||
if (empty($this->_authenticateObjects)) {
|
||||
$this->constructAuthenticate();
|
||||
}
|
||||
|
@ -678,11 +684,6 @@ class AuthComponent extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
$user = $this->user();
|
||||
if ($user) {
|
||||
$this->Session->delete('Auth.redirect');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1368,6 +1368,7 @@ class AuthComponentTest extends CakeTestCase {
|
|||
$_SERVER['PHP_AUTH_USER'] = 'mariano';
|
||||
$_SERVER['PHP_AUTH_PW'] = 'cake';
|
||||
|
||||
AuthComponent::$sessionKey = false;
|
||||
$this->Auth->authenticate = array(
|
||||
'Basic' => array('userModel' => 'AuthUser')
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue