我试图构建登录注册页面,我的网站,我现在面临的问题与他AUTH组件,为什么Auth Component的用户名和密码登录automagic在CakePHP中按预期工作?
function beforeFilter() {
$this->Auth->loginAction = array('controller'=>'users','action'=>'login');
$this->Auth->loginRedirect = array('controller'=>'users','action'=>'landing');
$this->Auth->logoutRedirect = array('controller'=>'users','action'=>'home');
// These pages do not require authenication<br/>
$this->Auth->allow('home','register','activate','forgot','reset','_sendEmail','reset');
}
我使用$this->Auth->password
方法加密并存储在数据库中的密码,现在连当我登录在成功地我不重定向到下用户控制的着陆页,我试着打印出$this->Auth
和它说
[loginError] => Login failed. Invalid username or password.
[authError] => You are not authorized to access that location.
而且在我的数据库对里面我是用认证的领域是电子邮件和密码,我读的地方, AuthComponent需要字段t o是用户名和密码automagic工作
我无法弄清楚我做错了,也登录后,如果我试图指向我的浏览器http://cake.localhost/users/register它应该会自动重定向到目标页面,但它doesnt因为某些原因。
任何线索,我去哪里错了?
希夫
我可以假设,这是里面app_controller.php?您是否意外地将此控制器添加为授权的acos?那么你可能不得不去确保所有用户组都可以看到这个消息。 – codingbear 2009-06-06 05:33:30
这是里面UsersController – Shiv 2009-06-06 17:05:23
loginAction/loginRedirect/logoutRedirect应该在app_controller的beforeFilter()..至少,这就是我发现作为一个更好的设计 – codingbear 2009-06-07 04:33:20