CakePHP Auth + ACL无法使用IE登录

时间:2011-10-14 15:58:45

标签: session cakephp-1.3 acl authentication

正如标题所暗示我无法使用IE登录我的CakePHP应用程序。相同的用户名和密码适用于Chrome,Firefox,Opera和Safari ......不是IE(所有版本7-9)。页面刷新,就像ACL和/或Auth失败一样。

$ this-> Session-> flash('auth')或$ this-> Session-> flash()中没有错误。

我不知所措......

以下是代码:

控制器:

function login(){
    $this->layout = 'content';
}

查看:

echo $this->Html->div('login_area',
    $this->Html->div('login_form', 
        $this->Html->div('error', $this->Session->flash()).
        $this->Html->div('error', $this->Session->flash('auth')).
        $this->Html->div('login_header', 'Member Login').
        '<hr>'.
        $form->create('User', array('action' => 'login')).
            $this->Html->div('login_line', 
                $this->Html->div('left', 'Username: ').
                $this->Html->div('right', $this->Form->input('username', array('div' => false, 'label' => false)))
            ).
            $this->Html->div('login_line', 
                $this->Html->div('left', 'Password: ').
                $this->Html->div('right', $this->Form->input('password', array('div' => false, 'label' => false)))
            ).
            $this->Html->div('login_line', $this->Html->div('login_button', $this->Form->submit('Login'))).
            $this->Html->div('clear').
        $form->end().
        $this->Html->div('', $this->Html->link('Forgot your password?', array('controller' => 'users', 'action' => 'recover_password')), array('style' => 'text-align:center'))
    )
);

AppController:

var $components = array('Acl', 'Auth', 'Session','Filter');
var $helpers = array('Html', 'Form', 'Session');
function beforeFilter(){
    $this->Auth->actionPath = 'controllers/';
    $this->Auth->authorize = 'actions';
    $this->Auth->authError = 'Please login to view this page.';
    $this->Auth->loginError = 'Incorrect username/password combination';
    $this->Auth->logoutRedirect = array('controller' => 'pages', 'action' => 'index');
    $this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'dashboard');
}

1 个答案:

答案 0 :(得分:4)

我找到了解决方法。系统管理员设置站点subdomain.domain.com ...子域中有一个下划线。

当域的任何部分中存在下划线时,IE无法保存会话。

注意:在我测试期间,似乎只有IE以这种方式行事,所有其他浏览器(Chrome,FireFox,Safari,Opera)在这种情况下保存会话信息就好了。