Monday, July 15, 2013

Auth login failing

I need some help in determining why my login is failing suddenly. It was working fine, then I began adding ACL. It still worked then suddenly no joy. Back-tracking hasn't uncovered where things went wrong and now I'm thoroughly confused.

public function login() {
debug($this->request->data);
}

gives:

array(
'User' => array(
'password' => '*****',
'username' => 'user'
)
)

I know that Auth would in the past empty out the password field upon failure; is this new that it replaces the value with asterisks? When I put a print_r($_POST, true) in webroot/index.php everything looks fine.

In any case, does anyone have a suggestion for why this is happening at all? I'd be most grateful for any suggestions.

FWIW, these both give the same result:
debug(Security::hash('foo', 'sha1', true));
debug($this->Auth->password('foo'));

My Auth config:

'Auth' => array(
'loginAction' => array(
'plugin' => false,
'admin' => false,
'controller' => 'users',
'action' => 'login'
),
'autoRedirect' => true,
'loginRedirect' => array(
'admin' => 1,
'plugin' => 'Pages',
'controller' => 'pages',
'action' => 'display'
),
'logoutRedirect' => array(
'admin' => 0,
'plugin' => 'Pages',
'controller' => 'pages',
'action' => 'display'
),
'authenticate' => array(
'Form' => array(
'fields' => array(
'username' => 'username',
'password' => 'password'
)
)
),
'authorize' => array(
'Actions' => array('actionPath' => 'controllers')
),
'loginError' => 'No matching user found.',
'authError' => 'Please log in'
)

> select * from acos limit 1;
+-----+-----------+-------+-------------+-------------+------+------+
| id  | parent_id | model | foreign_key | alias       | lft  | rght |
+-----+-----------+-------+-------------+-------------+------+------+
| 339 |      NULL | NULL  |        NULL | controllers |    1 |  172 |
+-----+-----------+-------+-------------+-------------+------+------+

> select * from aros;
+----+-----------+-------+-------------+-------+------+------+
| id | parent_id | model | foreign_key | alias | lft  | rght |
+----+-----------+-------+-------------+-------+------+------+
|  6 |      NULL | Role  |           6 | NULL  |    1 |    2 |
|  7 |      NULL | Role  |           7 | NULL  |    3 |    4 |
|  8 |      NULL | Role  |           8 | NULL  |    5 |    6 |
|  9 |      NULL | Role  |           9 | NULL  |    7 |    8 |
+----+-----------+-------+-------------+-------+------+------+

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: