我下载了 cakephp 的最新版本,即 cakephp 2.4。
当我使用 Auth 组件时,它不检查密码。
当我看到 sql dump 它显示
SELECT User.id, User.role_id, User.username, User.password,
User.email, User.first_name, User.last_name, User.activation_key,
User.status, User.created, User.modified
FROM cakephp.users AS User WHERE User.username = 'admin'
AND User.status = 1 LIMIT 1
它应该是
SELECT User.id, User.role_id, User.username, User.password, User.email,
User.first_name, User.last_name, User.activation_key, User.status,
User.created, User.modified FROM cakephp.users AS User
WHERE User.username = 'admin'
AND User.password = '32ddqdsd34sfgtbvge434' AND User.status = 1 LIMIT 1
我的 Auth 组件代码是
$this->Auth->userModel = 'User';
$this->Auth->authenticate = array(
'Form' => array(
'scope' => array('User.status' => 1)
)
);
$this->Auth->loginError = __("login_failed_invalid_username_or_password");
$this->Auth->loginAction = array('admin' => true, 'controller' => 'admins', 'action' => 'login');
$this->Auth->loginRedirect = array('admin' => true, 'controller' => 'admins', 'action' => 'dashboard');
$this->Auth->authError = __('you_must_login_to_view_this_information');
$this->Auth->autoRedirect = true;