diff options
Diffstat (limited to 'config/bootstrap/auth.php')
-rw-r--r-- | config/bootstrap/auth.php | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/config/bootstrap/auth.php b/config/bootstrap/auth.php index 75a2b5a..acbc4d5 100644 --- a/config/bootstrap/auth.php +++ b/config/bootstrap/auth.php @@ -31,16 +31,17 @@ Auth::config(array( }, function($data) { - if (!empty($data['username'])) { - - //Find the first element record that matches the username in the request and get the salt field - $salt = User::find('first', array('conditions' => array('username' => $data['username']))); - - //The password to query is the password from the request - //hashed with the users stored salt - $data['password'] = Password::hash($data['password'], $salt->salt); - } - return $data; + if(isset($data['username'])) + { + //Gett the user from the database + $user = User::find('first', array('conditions' => array('username' => $data['username']))); + + //Hash the submitted password with the stored salt. + $data['password'] = Password::hash($data['password'], $user->salt); + + } + return $data; + }) ) )); |