<?php
namespace Admin\MainBundle\Controller;
use AppBundle\Controller\AbstractController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
/**
* Class SecurityController
* @package Admin\MainBundle\Controller
*/
class SecurityController extends AbstractController
{
/**
* @Route("/login", name="login")
* @Template()
*/
public function loginAction(Request $request)
{
if ($this->isGranted("ROLE_USER")) {
return $this->redirectToRoute('homepage');
}
$authUtils = $this->get('security.authentication_utils');
// get the login error if there is one
$error = $authUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authUtils->getLastUsername();
return array(
'last_username' => $lastUsername,
'error' => $error,
);
}
/**
* @Route("/login_check", name="security_login_check")
*/
public function loginCheckAction()
{
throw new \Exception('This should never be reached!');
}
/**
* @Route("/logout", name="logout")
*/
public function logoutAction()
{
throw new \Exception('This should never be reached!');
}
/**
* @Route("/registration", name="security_registration")
*/
public function registrationAction()
{
throw new \Exception('This should never be reached!');
}
/**
* @Route("/profile", name="profile")
*/
public function profileAction() {
throw new \Exception('This should never be reached!');
}
/**
* @Route("/promotions", name="account_promotions")
*/
public function accountPromotionsAction() {
throw new \Exception('This should never be reached!');
}
}