add check for session driver before using auth class.

This commit is contained in:
Taylor Otwell 2011-08-06 20:24:09 -05:00
parent 59123fdfb0
commit d59b3ad90a
1 changed files with 5 additions and 5 deletions

View File

@ -1,5 +1,10 @@
<?php namespace System; <?php namespace System;
if (Config::get('session.driver') == '')
{
throw new \Exception("You must specify a session driver before using the Auth class.");
}
class Auth { class Auth {
/** /**
@ -35,11 +40,6 @@ public static function check()
*/ */
public static function user() public static function user()
{ {
if (Config::get('session.driver') == '')
{
throw new \Exception("You must specify a session driver before using the Auth class.");
}
if (is_null(static::$user) and Session::has(static::$key)) if (is_null(static::$user) and Session::has(static::$key))
{ {
static::$user = call_user_func(Config::get('auth.by_id'), Session::get(static::$key)); static::$user = call_user_func(Config::get('auth.by_id'), Session::get(static::$key));