As the title suggests I cannot log into my CakePHP application with IE. Same username and password works fine with Chrome, Firefox, Opera and Safari… just not IE (All version 7-9). Page refreshes as if ACL and/or Auth failed.
There are no errors in $this->Session->flash(‘auth’) or $this->Session->flash().
I am at a loss…
Here is the code:
Controller:
function login(){
$this->layout = 'content';
}
View:
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');
}
I have found a solution to this. The system administrator setup the site subdomain.domain.com… there was an underscore in the subdomain.
Turns out IE is unable to save sessions when there is an underscore in any part of the domain.
Note: During my testing it appears that only IE acts this way, all other browsers (Chrome, FireFox, Safari, Opera) save the session information just fine in this situation.