send 403 response if clientdon't have trusted IP

This commit is contained in:
Manuel Raynaud
2013-10-05 10:51:32 +02:00
parent 7db9e3765e
commit f4bff3fdc9

View File

@@ -42,11 +42,11 @@ $request = Request::createFromGlobals();
$thelia = new Thelia("dev", true);
if ( false === in_array($request->getClientIp(), $trustedIp)) {
// Redirect 401 Unauthorized
$response = new Response('Unauthorized', 401);
$response = Response::create('Forbidden', 403)->send();
$thelia->terminate($request, $response);
} else {
$response = $thelia->handle($request)->prepare($request)->send();
$thelia->terminate($request, $response);
}
$response = $thelia->handle($request)->prepare($request)->send();
$thelia->terminate($request, $response);