This commit is contained in:
JaguarJack 2020-09-04 19:01:57 +08:00
parent 9a5e7010b1
commit ca7a3df823
2 changed files with 4 additions and 3 deletions

View File

@ -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;

View File

@ -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);
}
// 记录用户登录