From 7337c12f4f3975cc72285790dad72b12f593a815 Mon Sep 17 00:00:00 2001 From: Ceeram Date: Fri, 19 Mar 2010 01:48:28 +0100 Subject: [PATCH 1/2] test for ticket #467 --- cake/tests/cases/libs/controller/components/auth.test.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cake/tests/cases/libs/controller/components/auth.test.php b/cake/tests/cases/libs/controller/components/auth.test.php index df19f67b6..122db1b76 100644 --- a/cake/tests/cases/libs/controller/components/auth.test.php +++ b/cake/tests/cases/libs/controller/components/auth.test.php @@ -625,7 +625,7 @@ class AuthTest extends CakeTestCase { } /** - * test that being redirected to the login page, with no post data does + * test that being redirected to the login page, with no post data does * not set the session value. Saving the session value in this circumstance * can cause the user to be redirected to an already public page. * @@ -1429,6 +1429,8 @@ class AuthTest extends CakeTestCase { 'id' => 1, 'username' => 'gwoo', 'created' => '2007-03-17 01:16:23', 'updated' => date('Y-m-d H:i:s') )); $this->assertEqual($user, $expected); + $sessionKey = $this->Controller->Auth->sessionKey; + $this->assertEqual('Auth.TestPluginAuthUser', $sessionKey); // Reverting changes Cache::delete('object_map', '_cake_core_'); From 71e2fb533d51577382a1f2090599c1dd5316bfaf Mon Sep 17 00:00:00 2001 From: Ceeram Date: Fri, 19 Mar 2010 01:49:41 +0100 Subject: [PATCH 2/2] fix for ticket #467 setting correct defaults when userModel is a plugin model --- cake/libs/controller/components/auth.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cake/libs/controller/components/auth.php b/cake/libs/controller/components/auth.php index 5a3c086c1..4236f614d 100644 --- a/cake/libs/controller/components/auth.php +++ b/cake/libs/controller/components/auth.php @@ -448,12 +448,14 @@ class AuthComponent extends Object { trigger_error(__("Could not find \$userModel. Please set AuthComponent::\$userModel in beforeFilter().", true), E_USER_WARNING); return false; } + list($plugin, $model) = pluginSplit($this->userModel); $defaults = array( 'loginAction' => array( - 'controller' => Inflector::underscore(Inflector::pluralize($this->userModel)), - 'action' => 'login' + 'controller' => Inflector::underscore(Inflector::pluralize($model)), + 'action' => 'login', + 'plugin' => $plugin, ), - 'sessionKey' => 'Auth.' . $this->userModel, + 'sessionKey' => 'Auth.' . $model, 'logoutRedirect' => $this->loginAction, 'loginError' => __('Login failed. Invalid username or password.', true), 'authError' => __('You are not authorized to access that location.', true)