update
This commit is contained in:
parent
9a5e7010b1
commit
ca7a3df823
@ -33,7 +33,7 @@ class Request extends \think\Request
|
|||||||
$user = $this->auth->guard($guard ? : config('catch.auth.default.guard'))->user();
|
$user = $this->auth->guard($guard ? : config('catch.auth.default.guard'))->user();
|
||||||
|
|
||||||
if ($user->status == Users::DISABLE) {
|
if ($user->status == Users::DISABLE) {
|
||||||
throw new LoginFailedException('该用户已被禁用');
|
throw new LoginFailedException('该用户已被禁用', Code::USER_FORBIDDEN);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
if ($e instanceof TokenExpiredException) {
|
if ($e instanceof TokenExpiredException) {
|
||||||
@ -45,7 +45,7 @@ class Request extends \think\Request
|
|||||||
if ($e instanceof TokenInvalidException) {
|
if ($e instanceof TokenInvalidException) {
|
||||||
throw new FailedException('token 不合法', Code::LOST_LOGIN);
|
throw new FailedException('token 不合法', Code::LOST_LOGIN);
|
||||||
}
|
}
|
||||||
throw new FailedException('认证失败: '. $e->getMessage(), Code::LOST_LOGIN);
|
throw new FailedException('认证失败: '. $e->getMessage(), $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
|
@ -6,6 +6,7 @@ use catchAdmin\permissions\model\Users;
|
|||||||
use catcher\base\CatchController;
|
use catcher\base\CatchController;
|
||||||
use catcher\CatchAuth;
|
use catcher\CatchAuth;
|
||||||
use catcher\CatchResponse;
|
use catcher\CatchResponse;
|
||||||
|
use catcher\Code;
|
||||||
use catcher\exceptions\LoginFailedException;
|
use catcher\exceptions\LoginFailedException;
|
||||||
use thans\jwt\facade\JWTAuth;
|
use thans\jwt\facade\JWTAuth;
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ class Index extends CatchController
|
|||||||
$user = $auth->user();
|
$user = $auth->user();
|
||||||
|
|
||||||
if ($user->status == Users::DISABLE) {
|
if ($user->status == Users::DISABLE) {
|
||||||
throw new LoginFailedException('该用户已被禁用');
|
throw new LoginFailedException('该用户已被禁用', Code::USER_FORBIDDEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 记录用户登录
|
// 记录用户登录
|
||||||
|
Loading…
x
Reference in New Issue
Block a user