<?php

namespace AppBundle\Controller;

use AppBundle\Form\Type\LoginType;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;

/**
 * Class SecurityController
 *
 * @package AppBundle\Controller
 */
class SecurityController extends Controller
{
    /**
     * @Route("/connexion", name="login")
     * @Method({"GET","POST"})
     */
    public function loginAction()
    {
        $helper = $this->get('security.authentication_utils');

        $formLogin = $this->createForm(LoginType::class, ['_email' => $helper->getLastUsername()]);

        return $this->render('security/login.html.twig', [
            'form_login' => $formLogin->createView(),
            'error' => $helper->getLastAuthenticationError(),
        ]);
    }

    /**
     * Check login
     */
    public function loginCheckAction()
    {

    }
}

<?php

namespace AppBundle\Controller;

use AppBundle\Form\Type\LoginType;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;

/**
 * Class SecurityController
 *
 * @package AppBundle\Controller
 */
class SecurityController extends Controller
{
    /**
     * @Route("/connexion", name="login")
     * @Method({"GET","POST"})
     */
    public function loginAction()
    {
        // Only for user not logged
        if($this->getUser()){
            return $this->redirectToRoute('homepage');
        }

        $helper = $this->get('security.authentication_utils');

        $formLogin = $this->createForm(LoginType::class, ['_email' => $helper->getLastUsername()]);

        return $this->render('security/login.html.twig', [
            'form_login' => $formLogin->createView(),
            'error' => $helper->getLastAuthenticationError(),
        ]);
    }

    /**
     * Check login
     */
    public function loginCheckAction()
    {

    }
}

Refactor (Security Controller): Define security acces level
Refactor (Security Controller): Define security acces level
