From daff4a9e465bb92e19ba4461a481e22c8ffbde52 Mon Sep 17 00:00:00 2001 From: Database Server Date: Mon, 7 Nov 2022 09:21:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=20Token=20=E5=90=8A=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/BanUser.php | 5 ++--- app/Http/Controllers/AuthController.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/Console/Commands/BanUser.php b/app/Console/Commands/BanUser.php index afbb1e7..dae07b4 100644 --- a/app/Console/Commands/BanUser.php +++ b/app/Console/Commands/BanUser.php @@ -2,7 +2,6 @@ namespace App\Console\Commands; -use App\Models\AccessToken; use App\Models\Host; use App\Models\User; use Illuminate\Console\Command; @@ -62,9 +61,9 @@ public function handle() 'suspended_at' => now() ]); - $this->info('正在清除 Token.'); + $this->info('正在吊销所有 Token...'); - AccessToken::where('user_id', $user_id)->delete(); + $user->tokens()->delete(); $this->info('封禁用户成功。'); diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index 0952317..5ca1673 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -36,7 +36,7 @@ public function index(Request $request) if (Auth::check()) { $user = Auth::user(); if ($user->banned_at !== null) { - $user->tokens()->delete(); + // $user->tokens()->delete(); return redirect()->route('banned'); } }