protected function attemptUserLogin($input)
{
// fieldnames in order or precedence
$fieldnames = $this->checkFieldExists('username') ? ['username', 'email'] : ['email'];
foreach ($fieldnames as $fieldname) {
if ($this->Auth->attempt(array($fieldname => $input['uname_or_email'], 'password' => $input['password'], 'activated' => 1), $this->getRememberMe($input))) {
return $this->retrieveUserFindMethodByField($fieldname, $input['uname_or_email']);
}
}
return false;
}