我创建了一个 CustomAuthenticate 类,如下所示,并将其放在 app/Controller/Component/Auth 下。我在 sqlite 数据库中有一个模型“用户”和相应的“用户”表。虽然我不想要表“用户”,但它不起作用。但是现在在表单上点击“登录”之后。它出现以下跟踪错误
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')
)
);
感谢你的帮助。