mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-14 19:40:53 +08:00
feat: new xboard
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Http\Middleware;
|
||||
|
||||
use App\Exceptions\ApiException;
|
||||
use App\Services\AuthService;
|
||||
use Auth;
|
||||
use Closure;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
@@ -18,14 +19,9 @@ class User
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$authorization = $request->input('auth_data') ?? $request->header('authorization');
|
||||
if (!$authorization) throw new ApiException( '未登录或登陆已过期', 403);
|
||||
|
||||
$user = AuthService::decryptAuthData($authorization);
|
||||
if (!$user) throw new ApiException('未登录或登陆已过期', 403);
|
||||
$request->merge([
|
||||
'user' => $user
|
||||
]);
|
||||
if (!Auth::guard('sanctum')->check()) {
|
||||
throw new ApiException('未登录或登陆已过期', 403);
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user