<commit_before><?php
namespace Cerad\Bundle\UserBundle\Action\Login;

use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
use Symfony\Component\Routing\RouterInterface;

class LoginForm
{
    private $authUtils;
    private $csrfTokenManager;
    private $router;

    public function __construct(
        AuthenticationUtils $authUtils,
        CsrfTokenManagerInterface $csrfTokenManager,
        RouterInterface $router
    )
    {
        $this->authUtils = $authUtils;
        $this->csrfTokenManager = $csrfTokenManager;
        $this->router = $router;
    }

    public function renderError()
    {
        $error = $this->authUtils->getLastAuthenticationError();

        if (!$error) return null;

        return <<<EOT
<div>{$error->getMessage()}</div>
EOT;
    }
    public function render()
    {
        $lastUsername = $this->authUtils->getLastUsername();
        $csrfToken = $this->csrfTokenManager->getToken('authenticate');
        $loginCheckPath = $this->router->generate('cerad_user_login_check');

        return  <<<EOT
{$this->renderError()}
<form action="{$loginCheckPath}" method="post">
    <label for="username">Username:</label>
    <input type="text" id="username" name="_username" value="{$lastUsername}" /><br />

    <label for="password">Password:</label>
    <input type="password" id="password" name="_password" /><br />

    <label for="remember_me" style="display:none">Remember Me:</label>
    <input type="checkbox" id="remember_me" name="_remember_me" style="display:none" />

    <input type="hidden" name="_csrf_token" value="{$csrfToken}" />

    <button type="submit">Login</button>
</form>
EOT;
    }
}<commit_msg>Renamed "Login" to "Sign In" to coordinate with menus<commit_after><?php
namespace Cerad\Bundle\UserBundle\Action\Login;

use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
use Symfony\Component\Routing\RouterInterface;

class LoginForm
{
    private $authUtils;
    private $csrfTokenManager;
    private $router;

    public function __construct(
        AuthenticationUtils $authUtils,
        CsrfTokenManagerInterface $csrfTokenManager,
        RouterInterface $router
    )
    {
        $this->authUtils = $authUtils;
        $this->csrfTokenManager = $csrfTokenManager;
        $this->router = $router;
    }

    public function renderError()
    {
        $error = $this->authUtils->getLastAuthenticationError();

        if (!$error) return null;

        return <<<EOT
<div>{$error->getMessage()}</div>
EOT;
    }
    public function render()
    {
        $lastUsername = $this->authUtils->getLastUsername();
        $csrfToken = $this->csrfTokenManager->getToken('authenticate');
        $loginCheckPath = $this->router->generate('cerad_user_login_check');

        return  <<<EOT
{$this->renderError()}
<form action="{$loginCheckPath}" method="post">
    <label for="username">Username:</label>
    <input type="text" id="username" name="_username" value="{$lastUsername}" /><br />

    <label for="password">Password:</label>
    <input type="password" id="password" name="_password" /><br />

    <label for="remember_me" style="display:none">Remember Me:</label>
    <input type="checkbox" id="remember_me" name="_remember_me" style="display:none" />

    <input type="hidden" name="_csrf_token" value="{$csrfToken}" />

    <button type="submit">Sign In</button>
</form>
EOT;
    }
}
{'fraction_non_alphanumeric': 0.15070821529745043, 'fraction_numerical': 0.0, 'mean_word_length': 3.9453781512605044, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 65, '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': '5405947', 'n_tokens_mistral': 1065, 'n_tokens_neox': 1029, 'n_words': 193}