Inheritance: extends Symfony\Component\DependencyInjection\ContainerAware
Exemplo n.º 1
0
 public function loginAction(\Symfony\Component\HttpFoundation\Request $request)
 {
     if ($this->container->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
         return new RedirectResponse($this->container->get('router')->generate('jg_compicture_compicture_index'));
     }
     return parent::loginAction($request);
 }
Exemplo n.º 2
0
 public function loginAction(Request $request)
 {
     $event = new \SKCMS\FrontBundle\Event\PreRenderEvent($this->getRequest());
     $this->get('event_dispatcher')->dispatch(\SKCMS\FrontBundle\Event\SKCMSFrontEvents::PRE_RENDER, $event);
     $response = parent::loginAction($request);
     return $response;
 }
Exemplo n.º 3
0
 /**
  * redirect to home when already authenticated
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function loginAction(Request $request)
 {
     if ($this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
         return $this->redirectToRoute('campaignchain_core_homepage');
     }
     return parent::loginAction($request);
 }
Exemplo n.º 4
0
 public function loginAction()
 {
     $request = $this->container->get('request');
     $ajax = $request->query->get('ajax', false);
     if ($ajax === false) {
         $response = parent::loginAction();
         return $response;
     }
     /* @var $request \Symfony\Component\HttpFoundation\Request */
     $session = $request->getSession();
     /* @var $session \Symfony\Component\HttpFoundation\Session\Session */
     // get the error if any (works with forward and redirect -- see below)
     if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
         $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
     } elseif (null !== $session && $session->has(SecurityContext::AUTHENTICATION_ERROR)) {
         $error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
         $session->remove(SecurityContext::AUTHENTICATION_ERROR);
     } else {
         $error = '';
     }
     if ($error) {
         // TODO: this is a potential security risk (see http://trac.symfony-project.org/ticket/9523)
         $error = $error->getMessage();
     }
     // last username entered by the user
     $lastUsername = null === $session ? '' : $session->get(SecurityContext::LAST_USERNAME);
     $csrfToken = $this->container->get('form.csrf_provider')->generateCsrfToken('authenticate');
     $response = new JsonResponse();
     $response->setData(array('last_username' => $lastUsername, 'error' => $error, 'csrf_token' => $csrfToken));
     return $response;
 }
 public function loginAction(Request $request)
 {
     if ($this->container->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
         return $this->redirect($this->generateUrl('trainingschedule_overview_index'));
     }
     return parent::loginAction($request);
 }
Exemplo n.º 6
0
 /**
  * Extends the parent loginAction by checking if the user is already logged in.
  * If so, he will be redirected to the admin dashboard.
  *
  * @param Request $request
  *
  * @return Response
  */
 public function loginAction(Request $request)
 {
     if ($this->container->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
         $url = $this->container->get('router')->generate('opifer_cms_dashboard');
         //            return new RedirectResponse($url, 302);
     }
     return parent::loginAction($request);
 }
 public function checkAction()
 {
     if ($this->userAlreadyLoggedIn()) {
         $router = $this->container->get('router');
         return new RedirectResponse($router->generate('fos_user_profile_edit'), 302);
     }
     return parent::checkAction();
 }
Exemplo n.º 8
0
 public function loginAction()
 {
     $userService = $this->container->get('mkd.user');
     if ($userService->userLoginStatus()) {
         return new RedirectResponse('/');
     }
     return parent::loginAction();
 }
Exemplo n.º 9
0
 /**
  * Extends the parent loginAction by checking if the user is already logged in.
  * If so, he will be redirected to the admin dashboard.
  *
  * @param  Request  $request
  * @return Response
  */
 public function loginAction(Request $request)
 {
     $securityContext = $this->container->get('security.context');
     if ($securityContext->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
         $url = $this->container->get('router')->generate('opifer.cms.dashboard.view');
         return new RedirectResponse($url, 302);
     }
     return parent::loginAction($request);
 }
Exemplo n.º 10
0
 /**
  * @Route("/login", name="login")
  */
 public function loginAction(Request $request)
 {
     $securityContext = $this->container->get('security.authorization_checker');
     if ($securityContext->isGranted('ROLE_USER')) {
         return new RedirectResponse($this->generateUrl('timeline'));
     }
     $response = BaseController::loginAction($request);
     return $response;
 }
Exemplo n.º 11
0
 /**
  * Authenticated users do not have access to this route.
  *
  * @param Request $request
  * @return RedirectResponse|Response
  */
 public function loginAction(Request $request)
 {
     $securityContext = $this->container->get('security.context');
     $router = $this->container->get('router');
     if ($securityContext->isGranted('ROLE_USER')) {
         return new RedirectResponse($router->generate('index'), 307);
     }
     return parent::loginAction($request);
 }
Exemplo n.º 12
0
 public function loginAction(Request $request)
 {
     $securityContext = $this->container->get('security.context');
     if ($securityContext->isGranted('ROLE_USER')) {
         return new RedirectResponse($this->generateUrl('user_account'), 302);
     }
     $response = parent::loginAction($request);
     // ... do custom stuff
     return $response;
 }
 public function loginAction()
 {
     $user = $this->container->get('security.context')->getToken()->getUser();
     if ($user instanceof UserInterface) {
         $this->container->get('session')->getFlashBag()->set('sonata_user_error', 'sonata_user_already_authenticated');
         $url = $this->container->get('router')->generate('sonata_user_profile_show');
         return new RedirectResponse($url);
     }
     return parent::loginAction();
 }
Exemplo n.º 14
0
 public function loginAction(Request $request)
 {
     $securityContext = $this->container->get('security.context');
     $router = $this->container->get('router');
     if ($securityContext->isGranted('ROLE_ADMIN')) {
         return $this->redirectToRoute('backend_admin_gallery_display');
     }
     $response = parent::loginAction($request);
     return $response;
 }
Exemplo n.º 15
0
 /**
  * @Route("/login")
  *
  * @param Request $request
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function loginAction(Request $request)
 {
     $response = parent::loginAction($request);
     //si l'on désire qu'une personne identifiée ne réaccède pas à la page /login;
     /*if( $this->container->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY') ){
     
               $route = $this->container->get('router')->generate('UserBundle_index');
               return new RedirectResponse($route);
           }*/
     return $response;
 }
 /**
  * login
  *
  * @Route("/login", name="login_override")
  * @Template
  */
 public function loginAction(Request $request)
 {
     $currentDate = new \DateTime();
     $cutoffDate = new \DateTime("2014-10-01 00:00:00");
     if ($currentDate >= $cutoffDate) {
         $route = $this->container->get('router')->generate('login-disabled');
         return new RedirectResponse($route);
     } else {
         $response = parent::loginAction($request);
     }
     return $response;
 }
Exemplo n.º 17
0
 public function loginAction(Request $request)
 {
     $user = $this->container->get('security.context')->getToken()->getUser();
     if ($user instanceof UserInterface) {
         $this->container->get('session')->getFlashBag()->set('sonata_user_error', 'sonata_user_already_authenticated');
         $url = $this->container->get('router')->generate('cls_home_homepage');
         return new RedirectResponse($url);
     }
     if ($this->container->get('security.authorization_checker')->isGranted('ROLE_ADMIN')) {
         $refererUri = $request->server->get('HTTP_REFERER');
         return new RedirectResponse($refererUri && $refererUri != $request->getUri() ? $refererUri : $this->container->get('router')->generate('cls_home_homepage'));
     }
     return parent::loginAction($request);
 }
 /**
  * @param Request $request
  *
  * @return Response|RedirectResponse
  */
 public function loginAction(Request $request)
 {
     if ($this->getUser() instanceof UserInterface) {
         $this->get('session')->getFlashBag()->set('sonata_user_error', 'sonata_user_already_authenticated');
         $url = $this->generateUrl('sonata_admin_dashboard');
         return $this->redirect($url);
     }
     $response = parent::loginAction($request);
     if ($this->isGranted('ROLE_ADMIN')) {
         $refererUri = $request->server->get('HTTP_REFERER');
         return $this->redirect($refererUri && $refererUri != $request->getUri() ? $refererUri : $this->generateUrl('sonata_admin_dashboard'));
     }
     return $response;
 }
Exemplo n.º 19
0
 public function loginAction(Request $request)
 {
     $response = parent::loginAction($request);
     $session = $request->getSession();
     $responseType = $request->query->get('response_type');
     $redirectUrl = $request->query->get('redirect_url');
     if ($responseType !== null && $redirectUrl !== null && $responseType == 'token') {
         $session->set('responseType', $responseType);
         $session->set('redirectUrl', $redirectUrl);
     } else {
         $session->remove('responseType');
         $session->remove('redirectUrl');
     }
     return $response;
 }
 /**
  * Agrega el token para el registro de usuario al formulario de inicio de sesion para ofrecer registro desde el mismo
  * @param array $data
  * @return type
  */
 protected function renderLogin(array $data)
 {
     //Backward compatibility with Fos User 1.3
     if (class_exists('FOS\\UserBundle\\FOSUserEvents')) {
         /** @var $formFactory \FOS\UserBundle\Form\Factory\FactoryInterface */
         $formFactory = $this->container->get('fos_user.registration.form.factory');
         $form = $formFactory->createForm();
     } else {
         $form = $this->container->get('fos_user.registration.form');
     }
     $csrf_token_register = '';
     if (isset($form->createView()->children['_token'])) {
         $csrf_token_register = $form->createView()->children['_token']->vars['value'];
     }
     $data['csrf_token_register'] = $csrf_token_register;
     return parent::renderLogin($data);
 }
Exemplo n.º 21
0
 /**
  * @Route("/login", name="admin_login")
  * {@inheritdoc}
  */
 public function loginAction(Request $request)
 {
     /** @var UserInterface $user */
     $user = $this->container->get('security.token_storage')->getToken()->getUser();
     if ($user instanceof UserInterface && ($user->hasRole('ROLE_ADMIN') || $user->isSuperAdmin())) {
         return new RedirectResponse($this->container->get('router')->generate('admin_dashboard'));
     }
     //clear error if the login don`t have any referer
     /** @var Request $request */
     $request = $this->container->get('request_stack')->getCurrentRequest();
     if ($request->getSession() && !$request->headers->get('referer')) {
         $request->getSession()->set(Security::LAST_USERNAME, null);
         $request->getSession()->set(Security::AUTHENTICATION_ERROR, null);
         $request->getSession()->set(Security::ACCESS_DENIED_ERROR, null);
     }
     return parent::loginAction($request);
 }
 public function loginAction()
 {
     $request = $this->container->get('request');
     $httpKernel = $this->container->get('http_kernel');
     $target_path = $request->getSession()->get('_security.target_path', null);
     $parseUrl = parse_url($target_path);
     if ($parseUrl !== false) {
         $router = $this->container->get('router');
         try {
             $targetRoute = $router->match($parseUrl['path']);
             if ($targetRoute['_route'] == 'AppSiteBundle_shop_displayOrder') {
                 return $httpKernel->forward('AppSiteBundle:PurchaseProcess:identification');
             }
         } catch (\Exception $e) {
         }
     }
     $response = parent::loginAction();
     return $response;
 }
Exemplo n.º 23
0
 public function loginAction()
 {
     $request = $this->container->get('request');
     /** @var $request \Symfony\Component\HttpFoundation\Request */
     $session = $request->getSession();
     /** @var $session \Symfony\Component\HttpFoundation\Session */
     /**
      * Replaces the original authentication error with a new exception object with
      * Always the same error message, this for security reasons.
      */
     if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
         $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
         $exception = new BadCredentialsException('Invalid username or password', 0, $error);
         $request->attributes->set(SecurityContext::AUTHENTICATION_ERROR, $exception);
     } elseif (null !== $session && $session->has(SecurityContext::AUTHENTICATION_ERROR)) {
         $error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
         $exception = new BadCredentialsException('Invalid username or password', 0, $error);
         $session->set(SecurityContext::AUTHENTICATION_ERROR, $exception);
     }
     return parent::loginAction();
 }
Exemplo n.º 24
0
 /**
  * {@inheritdoc}
  * @Route("/logout", name="logout")
  */
 public function logoutAction()
 {
     parent::logoutAction();
 }
Exemplo n.º 25
0
 public function loginAction(Request $request)
 {
     return parent::loginAction($request);
 }
Exemplo n.º 26
0
 /**
  * @Route("/login", name="bdn_login")
  */
 public function loginAction(Request $request)
 {
     $return = parent::loginAction($request);
     return new JsonResponse($return, 401);
 }
 /**
  * {@inheritdoc}
  */
 public function render($view, array $parameters = array(), Response $response = null)
 {
     return $this->renderDocumentResponse(parent::render($view, $parameters, $response));
 }
 protected function renderLogin(array $data)
 {
     $request = $this->container->get('request');
     $route = $request->get('_route');
     return $route == "fos_user_security_login" ? parent::renderLogin($data) : $this->container->get('templating')->renderResponse('ImageAnnotatorBundle:Member:navbarLogin.html.twig', $data);
 }