cakephp 2.7.5管理员身份验证不会对

时间:2015-10-18 06:49:05

标签: php cakephp authentication

我正在使用cakephp 2.7.5进行简单的管理员身份验证,但是当我尝试登录时,它还没有工作我之前在其他2.X版本的蛋糕中做了好几次..也许这次我没有做好安静的事情。 这是代码:

App控制器:

class AppController extends Controller {

public $components = ['Paginator', 'Flash', 'Auth' => [
                                 'loginRedirect' => ['controllers' => 'users', 'action' => 'admin_index'],
                                 'logoutRedirect' => ['controllers' => 'users', 'action' => 'index'],
                                 'authError' => 'No puedes accesar esta página',
                                 'authorize' => ['controller'] 
                                ]

                     ];

public function isAuthorized($user){
    return true;
}                    
}

在用户模型中,我有这个用来在保存之前散列密码。

public function beforeSave($options = array()){
    if($this->data['User']['password']){
        $this->data['User']['password'] = AuthComponent::password($this->request->data['User']['password']);
    }
    return true;
} 

在用户控制器中,我有admin_login方法:

public function admin_login() {

    if($this->request->is('post')){
        if($this->Auth->login()){
            $this->redirect($this->Auth->redirect());
        }else{
            $this->Flash->error('La convinacion de usuario/passwowrd es incorrecta.');
        }
    }

}

我是否丢失了总是抛出admin_login方法中的错误的东西?

如果一切正常,怎么能更深入地调试呢?

0 个答案:

没有答案
相关问题