From 0d2cfd24177c17f6fc91db24388cfee5bc375a15 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 11 Jul 2011 12:42:19 -0700 Subject: [PATCH] Refactor Auth class to use Auth config closures. --- system/auth.php | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/system/auth.php b/system/auth.php index c5ced635..92be397a 100644 --- a/system/auth.php +++ b/system/auth.php @@ -42,7 +42,7 @@ class Auth { if (is_null(static::$user) and Session::has(static::$key)) { - static::$user = forward_static_call(array(static::model(), 'find'), Session::get(static::$key)); + static::$user = call_user_func(Config::get('auth.by_id'), Session::get(static::$key)); } return static::$user; @@ -59,9 +59,7 @@ class Auth { */ public static function login($username, $password) { - $user = forward_static_call(array(static::model(), 'where'), Config::get('auth.username'), '=', $username)->first(); - - if ( ! is_null($user)) + if ( ! is_null($user = call_user_func(Config::get('auth.by_username'), $username))) { if (Hash::check($password, $user->password)) { @@ -88,14 +86,4 @@ class Auth { static::$user = null; } - /** - * Get the authentication model. - * - * @return string - */ - private static function model() - { - return '\\'.Config::get('auth.model'); - } - } \ No newline at end of file