改进 Token 吊销

This commit is contained in:
Database Server 2022-11-07 09:21:03 +08:00
parent bf25d56705
commit daff4a9e46
2 changed files with 3 additions and 4 deletions

View File

@ -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('封禁用户成功。');

View File

@ -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');
}
}