I've got the dead simplest login setup here but it's consistently
failing and I'm out of ideas for debugging this. I have admin routing
enabled and am trying to , no surprise, log in as an admin.
db_dam=# select * from users where model = 'Admin';
id | enabled | model | foreign_key | email |
password | last_login
----+---------+-------+-------------+------------------------+------------------------------------------+------------
1 | t | Admin | 1 | [EMAIL PROTECTED] |
b45c0cb88fd7f6cf4136554605f08ece73297664 |
(1 row)
I got the password by doing:
debug($this->Auth->password(array('User' => array('password' => 'foobar'))));
admin_login.ctp
<?= $form->create('User', array('action' => 'admin_login')) ?>
<?= $form->input('User.email') ?>
<?= $form->input('User.password') ?>
<?= $form->submit('Login') ?>
<?= $form->end() ?>
UsersController:
function admin_login()
{
if (!empty($this->data))
{
if ($this->Auth->login())
{
$this->redirect($this->Auth->redirect());
}
else
{
$this->Session->setFlash($this->Auth->authError);
}
}
}
AppController:
function beforeFilter()
{
$this->Auth->fields = array('username' => 'email', 'password' =>
'password');
$this->Auth->authorize = 'controller';
$this->Auth->loginAction = array('controller' => 'users', 'action' =>
'login');
$this->Auth->loginRedirect = array('controller' => 'users', 'action'
=> 'index');
$this->Auth->logoutRedirect = '/';
$this->Auth->autoRedirect = false;
$this->Auth->allow('setLang', 'enableComponent', 'enableElement',
'disableElement', 'flash');
}
//(temporarily)
function isAuthorized()
{
return true;
}
I thought that $this->Auth->loginAction, being set to login() and not
admin_login() was causing the problem.But a log() statement in the
former shows nothing so it doesn't seem to be redirecting there
instead.
What am i missing here?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---