public function onRegistrationCompleted(FilterUserResponseEvent $event)
 {
     $user = $event->getUser();
     $tenantName = $this->_form->get('tenantName')->getData();
     $tenantSubdomain = $this->_form->get('tenantSubdomain')->getData();
     $tenant = $this->registrationManager->createTenant($user, $tenantName, $tenantSubdomain);
     // this referenced redirect response will be used
     $this->redirectResponse->setTargetUrl($this->tenantAwareRouter->generateUrl($tenant));
     unset($this->_form);
 }
 /**
  * {@inheritdoc}
  */
 public function setTargetUrl($url)
 {
     if (!$this->isSafe($url)) {
         throw new \InvalidArgumentException(sprintf('It is not safe to redirect to %s', $url));
     }
     return parent::setTargetUrl($url);
 }
예제 #3
0
 public function setTargetUrl($url)
 {
     if ($url == '') {
         $url = '/';
     }
     return parent::setTargetUrl($url);
     // TODO: Change the autogenerated stub
 }
예제 #4
0
 /**
  * When redirecting to the backend dashboard (while logged in),
  * if the user does not have access change the redirect to the homepage.
  *
  * @param \Symfony\Component\HttpFoundation\RedirectResponse $response
  */
 protected function handleNoBackendAccess(RedirectResponse $response)
 {
     $authCookie = $this->session->get('authentication');
     if (!$this->authentication->isValidSession((string) $authCookie)) {
         return;
     }
     $dashboardPath = $this->urlGenerator->generate('dashboard');
     $dashboardAccess = $this->users->isAllowed('dashboard');
     if ($response->getTargetUrl() === $dashboardPath && !$dashboardAccess) {
         $this->session->getFlashBag()->clear();
         $response->setTargetUrl($this->urlGenerator->generate('homepage'));
     }
 }
예제 #5
0
 /**
  * @param GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     if ($this->kernel->getEnvironment() == 'test' || HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
         // don't do anything if it's not the master request
         return;
     }
     $request = $event->getRequest();
     if ($request->attributes->get('_route') != 'page_promotion' || $request->getHost() == 'stfalcon.de' || $request->query->has('_check')) {
         return;
     }
     $response = new RedirectResponse('/');
     $locale = $this->geoIpService->getLocaleByIp($request->getClientIp());
     if ($request->getLocale() == $locale) {
         return;
     }
     $currentRouteParams = array_replace($request->attributes->get('_route_params'), ['_locale' => $locale]);
     $redirectUrl = $this->router->generate($request->attributes->get('_route'), $currentRouteParams);
     $response->setTargetUrl($redirectUrl);
     $event->setResponse($response);
 }
예제 #6
0
 public function testSetTargetUrl()
 {
     $response = new RedirectResponse('foo.bar');
     $response->setTargetUrl('baz.beep');
     $this->assertEquals('baz.beep', $response->getTargetUrl());
 }
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testSetTargetUrlNull()
 {
     $response = new RedirectResponse('foo.bar');
     $response->setTargetUrl(null);
 }