我无法登录Cakephp 2.4

时间:2014-03-16 21:07:27

标签: php sql cakephp

我在Cakephp 2.4中遇到Auth问题,无法登录,我在代码中找不到错误

我的AppController

http://pastebin.com/hmju7SHM

用户模型

http://pastebin.com/BMsuMFan

我的登录方法

public function cpadmin_login() 
    {
        $this->pageTitle = __('Login page', true);
        if ($this->request->is('post')) {
            if ($this->Auth->login()) {
                return $this->redirect($this->Auth->redirect());
            } else {
                $this->Session->setFlash(__('Username or password is incorrect'), 'default', array(), 'auth');
            }
        }
    }

虽然尝试通过用户名/密码登录,但事情不会发生,而且sql日志没有密码检查

sql log

SELECT `User`.`id`, `User`.`name`, `User`.`username`, `User`.`password`, `User`.`email`, `User`.`role_id`, `User`.`active`, `User`.`created`, `Role`.`id`, `Role`.`name`, `Role`.`roles` FROM `cairotweet`.`users` AS `User` LEFT JOIN `cairotweet`.`roles` AS `Role` ON (`User`.`role_id` = `Role`.`id`) WHERE `User`.`username` = 'admin' AND `User`.`active` = 1 LIMIT 1

1 个答案:

答案 0 :(得分:1)