我在这里面临着一个奇怪的问题。
我正在使用CakePHP 1.3.6 &对于IE 6-7-8,它不允许我登录。我使用的是正确的凭据。已使用日志中记录的内容进行测试。
未显示任何身份验证错误。(如果我使用了错误的凭据,它会显示身份验证错误,但对于正确的凭据,它不会显示任何内容:( )
我已经通过将日志记录到error.log文件中,测试了auth组件的所有可能性。
我检查了Auth->user方法。它会填充Auth会话,但即使它不会将我重定向到所需的位置。我还检查了authLoginurl :它在日志中也是正确的。
我已经检查了以下可能性,
1)更改了Core.php中的某些设置
-- Session.checkAgent设置为false -- Security.level设置为low -- Session.start设置为false
2)登录动作使用disableCache(),避免在浏览器中缓存登录数据。
3)注销后,我已经销毁了会话。
这是代码,
beforeFilter中的应用程序控制器:
$this->Auth->loginAction =array(‘控制器’登录‘用户’,‘=>’登录‘=>’);
$this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'myaccount');
$this->Auth->userScope = array('User.is_active' => '1', 'User.is_verified' => '1');
//$this->referer();
//auth errors //add it
$this->Auth->loginError = "Invalid username or password";
$this->Auth->authError = "Sorry, you must be logged in to visit these pages";
//logout
$this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login');用户控制器beforeFilter():
函数beforeFilter() {
parent::beforeFilter();
$this->Auth->allow(allowed_actions);}
特纳克斯,维杰
发布于 2011-05-24 15:56:38
我也遇到过同样的问题,它是在不同的蛋糕版本上,但也许这个解决方案会有所帮助。
在配置中,我创建了一个具有下列值的my_session.php文件:
ini_restore('session.referer_check');
ini_set('session.use_trans_sid', 0);
ini_set('session.name', Configure::read('Session.cookie'));
ini_set('session.cookie_lifetime', 0);
// Cookie path is now '/' even if you app is within a sub
// directory on the domain
$this->path = '/';
ini_set('session.cookie_path', $this->path);
ini_set('session.cookie_domain', env('HTTP_BASE'));重要的部分是$this->path的值,会话现在可用于整个域。
在会话的core.php中添加:
Configure::write('Session.save', 'my_session');希望这能有所帮助!
https://stackoverflow.com/questions/5832063
复制相似问题