Update Saqel Platform: 2026-09-11 20:37:10

This commit is contained in:
Hamza-Ayed
2026-09-11 20:37:10 +03:00
parent e61d56c8e1
commit cb4f2a3159
18 changed files with 1440 additions and 148 deletions
+11 -3
View File
@@ -15,14 +15,22 @@ class AuthMiddleware
*/
public function handle(Request $request, Response $response): void
{
$token = null;
$authHeader = $request->getHeader('authorization', '');
if (!$authHeader || !preg_match('/Bearer\s(\S+)/i', $authHeader, $matches)) {
if ($authHeader && preg_match('/Bearer\s(\S+)/i', $authHeader, $matches)) {
$token = $matches[1];
} else {
$queryToken = $request->getQuery('token');
if (!empty($queryToken)) {
$token = trim((string)$queryToken);
}
}
if (!$token) {
$response->status(401)->json(['error' => 'Unauthorized', 'message' => 'Token not provided or invalid format']);
exit;
}
$token = $matches[1];
$payload = Security::verifyJWT($token);
if (!$payload) {