x當我嘗試實現自定義登錄組件時,x給出錯誤「身份驗證適配器」xmlRpc「未找到」。Cakephp錯誤:未找到身份驗證適配器「xmlRpc」
在我AppController.php我有以下
<?php
App::uses('Controller', 'Controller');
//Custom Auth
App::uses('xmlRpc', 'Controller/Component/Auth');
class AppController extends Controller {
//Authentication component
public $components = array(
'Session',
'DebugKit.Toolbar',
'Auth' => array(
'authenticate' => array(
'xmlRpc'
)
)
);
}
然後我就在/Controller/Component/Auth/xmlRpc.php
位於<?php
App::uses('BaseAuthenticate', 'Controller/Component/Auth');
class xmlRpc extends BaseAuthenticate {
public function authenticate(CakeRequest $request, CakeResponse $response) {
return true;
}
}
?>
在我的用戶控制我自己的登錄compononent有以下幾點:
<?php
App::uses('AppController', 'Controller');
//Custom Auth
App::uses('xmlRpc', 'Controller/Component/Auth');
class UsersController extends AppController {
public function logout() {
return $this->redirect($this->Auth->logout());
}
public function login() {
if ($this->request->is('post')) {
if ($this->Auth->login()) {
return $this->redirect($this->Auth->redirectUrl());
// Prior to 2.3 use `return $this->redirect($this->Auth->redirect());`
} else {
$this->Session->setFlash(__('Username or password is incorrect'), 'default', array(), 'auth');
}
}
}
}
?>
順便說一下,在我的身份驗證功能,我總是返回真正的供測試用。一旦我擺脫了這個錯誤,會添加邏輯。請協助並輕鬆放輕鬆,因爲我的蛋糕n00b。如何獲取蛋糕以查看我的自定義身份驗證適配器?
謝謝。這工作! –