src/Admin/MainBundle/Controller/SecurityController.php line 20

Open in your IDE?
  1. <?php
  2. namespace Admin\MainBundle\Controller;
  3. use AppBundle\Controller\AbstractController;
  4. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  5. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  6. use Symfony\Component\HttpFoundation\Request;
  7. /**
  8.  * Class SecurityController
  9.  * @package Admin\MainBundle\Controller
  10.  */
  11. class SecurityController extends AbstractController
  12. {
  13.     /**
  14.      * @Route("/login", name="login")
  15.      * @Template()
  16.      */
  17.     public function loginAction(Request $request)
  18.     {
  19.         if ($this->isGranted("ROLE_USER")) {
  20.             return $this->redirectToRoute('homepage');
  21.         }
  22.         $authUtils $this->get('security.authentication_utils');
  23.         // get the login error if there is one
  24.         $error $authUtils->getLastAuthenticationError();
  25.         // last username entered by the user
  26.         $lastUsername $authUtils->getLastUsername();
  27.         return array(
  28.             'last_username' => $lastUsername,
  29.             'error'         => $error,
  30.         );
  31.     }
  32.     /**
  33.      * @Route("/login_check", name="security_login_check")
  34.      */
  35.     public function loginCheckAction()
  36.     {
  37.         throw new \Exception('This should never be reached!');
  38.     }
  39.     /**
  40.      * @Route("/logout", name="logout")
  41.      */
  42.     public function logoutAction()
  43.     {
  44.         throw new \Exception('This should never be reached!');
  45.     }
  46.     /**
  47.      * @Route("/registration", name="security_registration")
  48.      */
  49.     public function registrationAction()
  50.     {
  51.         throw new \Exception('This should never be reached!');
  52.     }
  53.     /**
  54.      * @Route("/profile", name="profile")
  55.      */
  56.     public function profileAction() {
  57.         throw new \Exception('This should never be reached!');
  58.     }
  59.     /**
  60.      * @Route("/promotions", name="account_promotions")
  61.      */
  62.     public function accountPromotionsAction() {
  63.         throw new \Exception('This should never be reached!');
  64.     }
  65. }