This commit is contained in:
baodev0
2026-09-23 15:17:18 +07:00
parent cd38c5d6d0
commit 82a71244ca
107 changed files with 3332 additions and 3306 deletions
+13
View File
@@ -27,6 +27,19 @@ class ApiAuthCheck
], 401);
}
// Token cấp trước lần đổi mật khẩu gần nhất → vô hiệu.
// ponytail: token cũ chưa có claim `pv` vẫn được nhận cho tới khi hết JWT_TTL (chỉ lúc mới deploy)
if ($checkGuard === 'client' && Auth::guard('client')->getToken()) {
$pv = Auth::guard('client')->payload()->get('pv');
if ($pv !== null && !hash_equals(Auth::guard('client')->user()->passwordVersion(), (string) $pv)) {
return response()->json([
'error' => true,
'message' => 'Phiên đăng nhập đã hết hạn, vui lòng đăng nhập lại.',
'code' => 401
], 401);
}
}
// Ensure request user is set for the controller
$request->setUserResolver(function () use ($checkGuard) {
return Auth::guard($checkGuard)->user();