类我使用的食谱使用下面的代码来创建自己的自定义验证:CakePHP的2.1 - > CustomAuthorization不能正常工作
// Controller/Auth/CustomAuthenticate.php
App::uses('BaseAuthenticate', 'Controller/Component/Auth');
class CustomAuthenticate extends BaseAuthenticate {
public function authenticate(CakeRequest $request, CakeResponse $response) {
return false;
}
}
// Controller/UserController.php
class UserController extends AppController {
var $components = array('Auth' => array('authenticate' => array('Custom')));
public function login() {
// some code that includes:
$this->Auth->login($this->request->data);
}
}
用正确的凭据
不知何故,登录似乎工作,虽然身份验证方法在我的CustomAuthentication类中返回false。
我使用CakePHP 2.1
可能是因为这就是你所有的'authenticate()'方法......是返回false。 – 2012-04-12 12:05:19