Add login-google, admin/errors routes and Google login methods1

This commit is contained in:
Hamza-Ayed
2026-04-23 23:30:17 +03:00
parent 8c9836a20c
commit 650cce2e86

View File

@@ -6,7 +6,7 @@ use Illuminate\Foundation\Configuration\Middleware;
return Application::configure(basePath: dirname(__DIR__)) return Application::configure(basePath: dirname(__DIR__))
->withRouting( ->withRouting(
api: __DIR__.'/../routes/api.php', api: __DIR__ . '/../routes/api.php',
health: '/up', health: '/up',
) )
->withMiddleware(function (Middleware $middleware) { ->withMiddleware(function (Middleware $middleware) {
@@ -21,32 +21,16 @@ return Application::configure(basePath: dirname(__DIR__))
$middleware->api(prepend: [ $middleware->api(prepend: [
\Illuminate\Http\Middleware\HandleCors::class, \Illuminate\Http\Middleware\HandleCors::class,
]); ]);
// Rate limiting for API
$middleware->throttleWithRedis();
}) })
->withExceptions(function (Exceptions $exceptions) { ->withExceptions(function (Exceptions $exceptions) {
// Never expose internal errors to API consumers // سنظهر الخطأ الحقيقي لنعرف ماذا يحدث في الـ login-jwt
$exceptions->render(function (\Throwable $e) { $exceptions->render(function (\Throwable $e) {
if (request()->expectsJson() || request()->is('v2/*')) { return response()->json([
$status = method_exists($e, 'getStatusCode') ? $e->getStatusCode() : 500;
$response = [
'status' => 'failure', 'status' => 'failure',
'message' => $status === 500 ? 'Internal server error' : $e->getMessage(), 'message' => 'DEBUG ERROR: ' . $e->getMessage(),
]; 'file' => $e->getFile(),
'line' => $e->getLine()
// Only include debug info in non-production ], 500);
if (config('app.debug') && $status === 500) {
$response['debug'] = [
'exception' => get_class($e),
'message' => $e->getMessage(),
'file' => $e->getFile() . ':' . $e->getLine(),
];
}
return response()->json($response, $status);
}
}); });
}) })
->create() ->create()