Procházet zdrojové kódy

Cleaned up auth by a few lines

Michael Francis před 14 roky
rodič
revize
e8f63ebfae
1 změnil soubory, kde provedl 11 přidání a 10 odebrání
  1. 11 10
      config/bootstrap/auth.php

+ 11 - 10
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;
+		        	
 	        })
     )
 ));