From ca7a3df82301893de5126d7b4b38f34dfebf24a2 Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Fri, 4 Sep 2020 19:01:57 +0800 Subject: [PATCH] update --- app/Request.php | 4 ++-- catch/login/controller/Index.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Request.php b/app/Request.php index 3319e2d..895cc8e 100644 --- a/app/Request.php +++ b/app/Request.php @@ -33,7 +33,7 @@ class Request extends \think\Request $user = $this->auth->guard($guard ? : config('catch.auth.default.guard'))->user(); if ($user->status == Users::DISABLE) { - throw new LoginFailedException('该用户已被禁用'); + throw new LoginFailedException('该用户已被禁用', Code::USER_FORBIDDEN); } } catch (\Exception $e) { if ($e instanceof TokenExpiredException) { @@ -45,7 +45,7 @@ class Request extends \think\Request if ($e instanceof TokenInvalidException) { throw new FailedException('token 不合法', Code::LOST_LOGIN); } - throw new FailedException('认证失败: '. $e->getMessage(), Code::LOST_LOGIN); + throw new FailedException('认证失败: '. $e->getMessage(), $e->getMessage()); } return $user; diff --git a/catch/login/controller/Index.php b/catch/login/controller/Index.php index 62f93ff..1859da0 100644 --- a/catch/login/controller/Index.php +++ b/catch/login/controller/Index.php @@ -6,6 +6,7 @@ use catchAdmin\permissions\model\Users; use catcher\base\CatchController; use catcher\CatchAuth; use catcher\CatchResponse; +use catcher\Code; use catcher\exceptions\LoginFailedException; use thans\jwt\facade\JWTAuth; @@ -28,7 +29,7 @@ class Index extends CatchController $user = $auth->user(); if ($user->status == Users::DISABLE) { - throw new LoginFailedException('该用户已被禁用'); + throw new LoginFailedException('该用户已被禁用', Code::USER_FORBIDDEN); } // 记录用户登录