From 4e8a803e8151d6e08037a279cf96e76da14070e5 Mon Sep 17 00:00:00 2001 From: nate Date: Thu, 12 Apr 2007 02:32:16 +0000 Subject: [PATCH] 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 --- cake/libs/controller/components/auth.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cake/libs/controller/components/auth.php b/cake/libs/controller/components/auth.php index 6e1c41672..e21e6672b 100644 --- a/cake/libs/controller/components/auth.php +++ b/cake/libs/controller/components/auth.php @@ -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']]