From b1f5c22c9db85fa1aed661ec6f3e40f95c5c5122 Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Thu, 20 Aug 2020 21:02:16 +0800 Subject: [PATCH] =?UTF-8?q?update:=E7=94=A8=E6=88=B7=E7=A6=81=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Request.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Request.php b/app/Request.php index 0038d01..3319e2d 100644 --- a/app/Request.php +++ b/app/Request.php @@ -3,9 +3,11 @@ namespace app; // 应用请求对象类 +use catchAdmin\permissions\model\Users; use catcher\CatchAuth; use catcher\Code; use catcher\exceptions\FailedException; +use catcher\exceptions\LoginFailedException; use thans\jwt\exception\TokenBlacklistException; use thans\jwt\exception\TokenExpiredException; use thans\jwt\exception\TokenInvalidException; @@ -29,6 +31,10 @@ class Request extends \think\Request try { $user = $this->auth->guard($guard ? : config('catch.auth.default.guard'))->user(); + + if ($user->status == Users::DISABLE) { + throw new LoginFailedException('该用户已被禁用'); + } } catch (\Exception $e) { if ($e instanceof TokenExpiredException) { throw new FailedException('token 过期', Code::LOGIN_EXPIRED);