From 70e35fb3d7340cf8b180693d9a5debaddce86f88 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 7 Jul 2011 23:00:40 -0500 Subject: [PATCH] refactoring auth class. --- system/arr.php | 2 ++ system/auth.php | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/system/arr.php b/system/arr.php index 24be1f2b..ba3875e5 100644 --- a/system/arr.php +++ b/system/arr.php @@ -5,6 +5,8 @@ class Arr { /** * Get an item from an array. * + * If the specified key is null, the entire array will be returned. + * * @param array $array * @param string $key * @param mixed $default diff --git a/system/auth.php b/system/auth.php index 9e247094..4fd8fcc8 100644 --- a/system/auth.php +++ b/system/auth.php @@ -64,11 +64,7 @@ public static function login($username, $password) if ( ! is_null($user)) { - // If a salt is present on the user record, we will recreate the hashed password - // using the salt. Otherwise, we will just use a plain hash. - $password = (isset($user->salt)) ? Hash::make($password, $user->salt)->value : sha1($password); - - if ($user->password === $password) + if ($user->password === Hash::make($password, $user->salt)->value) { static::$user = $user; @@ -89,6 +85,7 @@ public static function login($username, $password) public static function logout() { Session::forget(static::$key); + static::$user = null; }