Fixing SQL error in AuthComponent::identify() when username is empty (Ticket #2402)

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4847 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2007-04-12 02:32:16 +00:00
parent b0307904ae
commit 4e8a803e81

View file

@ -641,12 +641,18 @@ class AuthComponent extends Object {
}
if (is_array($user) && (isset($user[$this->fields['username']]) || isset($user[$this->userModel . '.' . $this->fields['username']]))) {
if (isset($user[$this->fields['username']])) {
if (isset($user[$this->fields['username']]) && !empty($user[$this->fields['username']])) {
if (trim($user[$this->fields['username']]) == '=') {
return false;
}
$find = array(
$this->fields['username'] => $user[$this->fields['username']],
$this->fields['password'] => $user[$this->fields['password']]
);
} else {
} elseif (isset($user[$this->userModel . '.' . $this->fields['username']]) && !empty($user[$this->userModel . '.' . $this->fields['username']])) {
if (trim($user[$this->userModel . '.' . $this->fields['username']]) == '=') {
return false;
}
$find = array(
$this->fields['username'] => $user[$this->userModel . '.' . $this->fields['username']],
$this->fields['password'] => $user[$this->userModel . '.' . $this->fields['password']]