不确定哪个部分出了问题,并试图通过谷歌搜索教程,但那里的来源没有运气。基本上,每当我尝试提交表单时,即使密码错误,它也会通过chrome网络进行检查并重定向到 google.com。有人对 cakephp 身份验证有更清晰的了解来指导我吗?
这是我所做的
应用控制器.php
public $components = array('DebugKit.Toolbar',
'Session',
'Auth');
用户控制器.php
public function login()
{
if ($this->request->is('post'))
{
$this->request->data['User']['username'] = $_POST['email'];
$this->request->data['User']['password'] = $_POST['password'];
if ($this->Auth->login())
{
$this->redirect('http://www.google.com');
}
}
}
我发现重定向不断进行的原因是以前的用户已经成功登录。所以我要做的是提供注销链接,然后重试。
public function logout() {
return $this->redirect($this->Auth->logout());
}
再次感谢大家。