|
@@ -31,16 +31,17 @@ Auth::config(array(
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
function($data) {
|
|
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;
|
|
|
|
|
+
|
|
|
})
|
|
})
|
|
|
)
|
|
)
|
|
|
));
|
|
));
|