当我尝试使用Google的搜索找到解决方案后,我仍然没有找到任何帮助我的东西。问题很简单,我想使用另一个模型进行用户认证。手册显示我们的方式在某种程度上不起作用。AuthComponent userModel仍然执行用户登录
我AppController中看起来像如下:
public $components = array(
'Auth',
'DebugKit.Toolbar'
);
public function beforeFilter()
{
parent::beforeFilter();
if (isset($this->request->params["intranet"]) && $this->request->params["intranet"] == 1) {
$this->Auth = array(
"loginAction" => array(
"intranet" => true,
"controller" => "employees",
"action" => "login"
),
"authenticate" => array(AuthComponent::ALL => array("userModel" => "Employee"))
);
$this->layout = "intranet";
}
}
不要紧,我开什么网址,CakePHP的总是重定向我/用户/登录。当然,我在控制器中运行parent :: beforeFilter()。
编辑:好好像我missunderstand 的usermodel,则loginAction似乎这里是正确的关键字,但之后,我把它改为阵列(“控制器” =>“雇员”,“行动” = >“登录”)它仍然将我重定向到/用户/登录...
你有没有尝试把'parent :: beforeFilter()'放在方法的* end *处? – thaJeztah 2013-03-17 22:00:37