fix: allow logout when user are banned

This commit is contained in:
Asnxthaony 2022-12-29 12:06:58 +08:00
parent cc8873ec31
commit 564672b436
No known key found for this signature in database
GPG Key ID: 6537C59306464F54

View File

@ -3,12 +3,15 @@
namespace App\Http\Middleware;
use App\Models\User;
use Closure;
class RejectBannedUser
{
public function handle($request, Closure $next)
public function handle($request, \Closure $next)
{
if ($request->is('auth/logout')) {
return $next($request);
}
if ($request->user()->permission == User::BANNED) {
if ($request->expectsJson()) {
$response = json(trans('auth.check.banned'), -1);