diff options
author | Michael Francis <edude03@gmail.com> | 2011-07-01 00:58:38 -0400 |
---|---|---|
committer | Michael Francis <edude03@gmail.com> | 2011-07-01 00:58:38 -0400 |
commit | e8f63ebfaeb9fd9463e89b676d8f4043d2d7e0d9 (patch) | |
tree | c9e14d5cfa855bd231360dd7d611fe4c47993174 | |
parent | 7590732794d85d40be404c149aef8305c50a9c02 (diff) | |
download | otakuhub-e8f63ebfaeb9fd9463e89b676d8f4043d2d7e0d9.tar.xz |
Cleaned up auth by a few lines
-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; + }) ) )); |