From c902d4c060033c88887ed7b012c0cfbd1a9f3be7 Mon Sep 17 00:00:00 2001 From: Ceeram Date: Wed, 23 Mar 2011 15:34:02 +0100 Subject: [PATCH] Auth enhancement, less calls to user() --- cake/libs/controller/components/auth.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cake/libs/controller/components/auth.php b/cake/libs/controller/components/auth.php index 759c5be36..d28d42480 100644 --- a/cake/libs/controller/components/auth.php +++ b/cake/libs/controller/components/auth.php @@ -382,7 +382,8 @@ class AuthComponent extends Object { $controller->data[$model->alias][$this->fields['password']] = null; return false; } else { - if (!$this->user()) { + $user = $this->user(); + if (!$user) { if (!$this->RequestHandler->isAjax()) { $this->Session->setFlash($this->authError, $this->flashElement, array(), 'auth'); if (!empty($controller->params['url']) && count($controller->params['url']) >= 2) { @@ -442,7 +443,7 @@ class AuthComponent extends Object { break; } - if ($this->isAuthorized($type)) { + if ($this->isAuthorized($type, null, $user)) { return true; }