Does the Auth component have an afterFind() method on the user model?
Because if I define an afterFind() function in the user model the authentication stops working, it keeps giving me login error.
If I comment the afterFind() function in the user model, the authentication starts working again.
Any ideas?
// User.php
function afterFind($results) {
foreach ($results as $key => $val) {
if (isset($val['User']['phone'])) {
$number = $val['User']['phone'];
$results[$key]['User']['phone'] = '(' . substr($number,0,3) . ') ' . substr($number,3,3) . ' - ' . substr($number,6);
}
}
}
Although it's not clearly documented, I believe afterFind()
need to return
something;
Try placing the following at the end of afterFind()
:
return $results;