Skip to content

Instantly share code, notes, and snippets.

@nomasprime
Created July 22, 2014 09:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nomasprime/b4a6d6ebfcef5a4cd39e to your computer and use it in GitHub Desktop.
Save nomasprime/b4a6d6ebfcef5a4cd39e to your computer and use it in GitHub Desktop.
<?php
namespace AnalogFolk\GatewayBundle\EventListener;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpFoundation\RedirectResponse;
use AnalogFolk\GatewayBundle\Security\Gateway\Geo;
use AnalogFolk\GatewayBundle\Controller\GatedController;
use AnalogFolk\GatewayBundle\Controller\MainController;
class GatewayListener
{
public function onKernelRequest(GetResponseEvent $event)
{
if ($event->isMasterRequest() === false || $event->getRequest()->getRequestFormat() !== 'html') {
return;
}
if ($event->getRequest()->attributes->get('_route') === 'analog_folk_gateway') return;
$response = new RedirectResponse('/gateway');
$event->setResponse($response);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment