我创建了一个CustomAuthenticate类,如下所示,并将其放在app / Controller / Component / Auth下。我在sqlite数据库中有一个模型'User'和相应的'users'表。虽然我不想要表'用户',但它不起作用。但是现在在表单上点击“登录”之后。使用以下跟踪错误输出
2012-10-10 00:57:59 Error: [CakeException] Authentication adapter "Custom" was not found.
#0 C:\Program Files (x86)\Ampps\www\application1\lib\Cake\Controller\Component\AuthComponent.php(630): AuthComponent->constructAuthenticate()
#1 C:\Program Files (x86)\Ampps\www\application1\lib\Cake\Controller\Component\AuthComponent.php(510): AuthComponent->identify(Object(CakeRequest), Object(CakeResponse))
#2 C:\Program Files (x86)\Ampps\www\application1\app\Controller\UsersController.php(70): AuthComponent->login()
#3 [internal function]: UsersController->login()
#4 C:\Program Files (x86)\Ampps\www\application1\lib\Cake\Controller\Controller.php(485): ReflectionMethod->invokeArgs(Object(UsersController), Array)
#5 C:\Program Files (x86)\Ampps\www\application1\lib\Cake\Routing\Dispatcher.php(186): Controller->invokeAction(Object(CakeRequest))
#6 C:\Program Files (x86)\Ampps\www\application1\lib\Cake\Routing\Dispatcher.php(161): Dispatcher->_invoke(Object(UsersController), Object(CakeRequest), Object(CakeResponse))
#7 C:\Program Files (x86)\Ampps\www\application1\app\webroot\index.php(92): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#8 {main}
AppController在组件数组中有以下内容。
public $components = array(
'Session',
'Auth' => array(
'loginRedirect' => array('controller' => 'ananlyze', 'action' => 'index'),
'logoutRedirect' => array('controller' => 'users', 'action' => 'login', 'home'),
'authenticate' => array('Custom','Form')
)
);
感谢您的帮助。
答案 0 :(得分:0)
你有没有在AppController中调用App::uses('CustomAuthenticate', 'Controller/Component/Auth');
?