instance check.

This commit is contained in:
James Cole 2015-12-28 07:39:48 +01:00
parent 52a0d7cf7b
commit 635b9f9dba

View File

@ -4,6 +4,7 @@ use App;
use Auth;
use Carbon\Carbon;
use Closure;
use FireflyIII\User;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request;
use Preferences;
@ -45,6 +46,7 @@ class Authenticate
*/
public function handle(Request $request, Closure $next)
{
if ($this->auth->guest()) {
if ($request->ajax()) {
return response('Unauthorized.', 401);
@ -53,7 +55,7 @@ class Authenticate
}
}
if (intval($this->auth->user()->blocked) == 1) {
if ($this->auth->user() instanceof User && intval($this->auth->user()->blocked) == 1) {
Auth::logout();
return redirect()->route('index');