<commit_before><?php

use Silex\Application;

use Symfony\Component\HttpFoundation\Request;
use SilexCMS\Response\TransientResponse;

$app->register(new SilexCMS\Security\Firewall('security', require __DIR__ . '/../config/users.php'));

$app->match('/login', function (Application $app, Request $req) {
    $security = $app['security'];

    if (null !== $security->getUserName()) {
        return $app->redirect($app['url_generator']->generate('administration_hub'));
    }

    if ($req->getMethod() === 'POST') {
         if ($security->bindSession()->getUserName() || $security->bindRequest($req)->getUsername()) {
             return $app->redirect($app['url_generator']->generate('administration_hub'));
         } else {
            $error = "L'identification a échouée.";
        }
    }

    return new TransientResponse($app['twig'], 'security/login.html.twig', array('error' => isset($error) ? $error : null));
})
->bind('login');

$app->get('/logout', function (Application $app, Request $req) {
    $app['security']->unbind();
    return $app->redirect($app['url_generator']->generate('index'));
})
->bind('logout');
<commit_msg>- removed security registration to main project<commit_after><?php

use Silex\Application;

use Symfony\Component\HttpFoundation\Request;
use SilexCMS\Response\TransientResponse;

$app->match('/login', function (Application $app, Request $req) {
    $security = $app['security'];

    if (null !== $security->getUserName()) {
        return $app->redirect($app['url_generator']->generate('administration_hub'));
    }

    if ($req->getMethod() === 'POST') {
         if ($security->bindSession()->getUserName() || $security->bindRequest($req)->getUsername()) {
             return $app->redirect($app['url_generator']->generate('administration_hub'));
         } else {
            $error = "L'identification a échouée.";
        }
    }

    return new TransientResponse($app['twig'], 'security/login.html.twig', array('error' => isset($error) ? $error : null));
})
->bind('login');

$app->get('/logout', function (Application $app, Request $req) {
    $app['security']->unbind();
    return $app->redirect($app['url_generator']->generate('index'));
})
->bind('logout');

{'fraction_non_alphanumeric': 0.2054176072234763, 'fraction_numerical': 0.0, 'mean_word_length': 4.238770685579196, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 40, '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': '4209391', 'n_tokens_mistral': 664, 'n_tokens_neox': 656, 'n_words': 115}