<commit_before><?php

namespace AppBundle\Controller\Auth;

use AppBundle\Utils\Utils;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Validator\Constraints\DateTime;

class AuthController extends Controller
{
    /**
     * @Route("/", name="index")
     * @param Request $request
     * @return \Symfony\Component\HttpFoundation\RedirectResponse
     */
    public function indexAction(Request $request)
    {
        if(!$this->_isLoggedIn())
            return $this->redirectToRoute('login');

        if($this->get('security.authorization_checker')->isGranted('ROLE_USER'))
            return $this->redirectToRoute('dashboard', array('id' => $request->get('id')));

        if($this->get('security.authorization_checker')->isGranted('ROLE_ADMIN'))
            return $this->redirectToRoute('admin_dashboard');

        if($this->get('security.authorization_checker')->isGranted('ROLE_REPRESENTATIVE')) {
            return $this->redirectToRoute('representative_dashboard');
        }
    }

    /**
     * @Route("/login", name="login")
     * @param Request $request
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function loginAction(Request $request)
    {
        $authenticationUtils = $this->get('security.authentication_utils');

        // get the login error if there is one
        $error = $authenticationUtils->getLastAuthenticationError();

        // last username entered by the user
        $lastUsername = $authenticationUtils->getLastUsername();

        return $this->render('security/login.html.twig', array(
            'last_username' => $lastUsername,<commit_msg>Adding redirect on login page<commit_after><?php

namespace AppBundle\Controller\Auth;

use AppBundle\Utils\Utils;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Validator\Constraints\DateTime;

class AuthController extends Controller
{
    /**
     * @Route("/", name="index")
     * @param Request $request
     * @return \Symfony\Component\HttpFoundation\RedirectResponse
     */
    public function indexAction(Request $request)
    {
        if(!$this->_isLoggedIn())
            return $this->redirectToRoute('login');

        if($this->get('security.authorization_checker')->isGranted('ROLE_USER'))
            return $this->redirectToRoute('dashboard', array('id' => $request->get('id')));

        if($this->get('security.authorization_checker')->isGranted('ROLE_ADMIN'))
            return $this->redirectToRoute('admin_dashboard');

        if($this->get('security.authorization_checker')->isGranted('ROLE_REPRESENTATIVE'))
            return $this->redirectToRoute('representative_dashboard');
    }

    /**
     * @Route("/login", name="login")
     * @param Request $request
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function loginAction(Request $request)
    {
        if($this->get('security.authorization_checker')->isGranted('ROLE_USER'))
            return $this->redirectToRoute('dashboard', array('id' => $request->get('id')));

        if($this->get('security.authorization_checker')->isGranted('ROLE_ADMIN'))
            return $this->redirectToRoute('admin_dashboard');

        if($this->get('security.authorization_checker')->isGranted('ROLE_REPRESENTATIVE'))
            return $this->redirectToRoute('representative_dashboard');

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

        // get the login error if there is one
        $error = $authenticationUtils->getLastAuthenticationError();

        // last username entered by the user
        $lastUsername = $authenticationUtils->getLastUsername();

        return $this->render('security/login.html.twig', array(
            'last_username' => $lastUsername,
{'fraction_non_alphanumeric': 0.14164588528678304, 'fraction_numerical': 0.0, 'mean_word_length': 3.6912280701754385, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 50, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5824069', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1081, 'n_words': 170}