<?php
namespace AppBundle\Controller;

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

/**
 * BlogSystem - Login as the default controller.
 *
 * @version 	0.1.1 27-Mar-16
 * @copyright   Copyright (c) 2016 by Andy Liebke. All rights reserved. (http://andysmiles4games.com)
 */
class DefaultController extends Controller
{
    /**
     * @Route("/", name="homepage")
     */
    public function indexAction(Request $request)
    {
        $auth = $this->get('security.authentication_utils');
        
        $listErrors = $auth->getLastAuthenticationError();
        
        /*var_dump($listErrors);*/
        
        return $this->render('page/login.html.twig', []);
    }
}

<?php
namespace AppBundle\Controller;

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

/**
 * BlogSystem - Login as the default controller.
 *
 * @version 	0.1.1 27-Mar-16
 * @copyright   Copyright (c) 2016 by Andy Liebke. All rights reserved. (http://andysmiles4games.com)
 */
class DefaultController extends Controller
{
    /**
     * @Route("/", name="homepage")
     */
    public function indexAction(Request $request)
    {
        $auth = $this->get('security.authentication_utils');
        $security = $this->get('security.authorization_checker');
        
        if ($security->isGranted('IS_AUTHENTICATED_FULLY')){
            return $this->redirectToRoute('admin_dashboard');
        } else {
            return $this->render('page/login.html.twig', []);
        }
    }
}

Fix login issue in case the user is already signed in
Fix login issue in case the user is already signed in

In case you're already signed in and visit the login page,
you have to sign in again, but actually u're still authenticated.
I have added a check that will lead to a redirection to the admin
dashboard in case you're still signed in otherwise you keep on the
login page.
