title: Basic login system Symfony
body: <p>I'm trying to build a basic login system with Symfony3 using my database. But everytimes I put correct credentials, I always got </p>
  
  <pre><code>Invalid credentials.
  Bad credentials.
  </code></pre>
  
  <p>I don't know why.</p>
  
  <p>Herey are my codes :</p>
  
  <p>login.html.twig</p>
  
  <pre><code> {% extends 'base.html.twig' %}
  {% block body %}
      &lt;div class="container-fluid" style="width: 400px"&gt;
          &lt;h2&gt;Please Sign In&lt;/h2&gt;
          {% if error %}
              &lt;div&gt;{{ error.messageKey|trans(error.messageData, 'security') }}&lt;/div&gt;
          {% endif %}
  &lt;form class="form-signin" method='post' action='{{path('login_check')}}'&gt;
      {% if error %}
          &lt;div class='red'&gt;{{ error.message }}&lt;/div&gt;&lt;br&gt;
      {% endif %}
      &lt;label for="inputName" class="sr-only"&gt;User Name&lt;/label&gt;
      &lt;input type="email" id="email" name='_username' class="form-control" placeholder="Email address" required autofocus&gt;
      &lt;label for="inputPassword" class="sr-only"&gt;Password&lt;/label&gt;
      &lt;input type="password" id="password" name="_password"  class="form-control" placeholder="Password" required&gt;
      &lt;button class="btn btn-lg btn-primary btn-block" type="submit"&gt;Connection&lt;/button&gt;
  &lt;/form&gt;
      &lt;/div&gt;
  {% endblock %}
  </code></pre>
  
  <p>SecurityController</p>
  
  <pre><code>class SecurityController extends Controller
  {
      /**
       * @Route("/login", name="login")
       */
      public function loginAction()
      {
          $authenticationUtils = $this-&gt;get('security.authentication_utils');
          // get the login error if there is one
          $error = $authenticationUtils-&gt;getLastAuthenticationError();
         // last username entered by the user
          $lastUsername = $authenticationUtils-&gt;getLastUsername();
  
          return $this-&gt;render('Security/login.html.twig', array(
              'last_username' =&gt; $lastUsername,
              'error'         =&gt; $error,
          ));
          //return $this-&gt;render('F3ILCocktailBundle:Default:index.html.twig');
      }
  }
  </code></pre>
  
  <p>security.yml</p>
  
  <pre><code>  security:
  
    firewalls:
  
      authentification:
        anonymous: true
        form_login:
          check_path: login_check
          default_target_path: admin_recette_new
          login_path: login
        logout:
          path: logout
          target: /login
        pattern: ^/
  
      dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false
  
      login:
        pattern: ^/login
        security: false
  
      main:
        anonymous: true
        pattern: ^/admin
        provider: our_db_provider
  
    providers:
      in_memory:
        memory: ~
      our_db_provider:
        entity:
          class: "F3ILCocktailBundle:User"
          property: email
  
    access_control:
      - { path: ^/admin, roles: ROLE_ADMIN }
  
    encoders:
      F3ILCocktailBundle\Entity\User:
        algorithm: bcrypt
        cost: 12
  </code></pre>
  
  <p>routing.yml</p>
  
  <pre><code>   f3_il_cocktail:
      resource: "@F3ILCocktailBundle/Controller/"
      type:     annotation
      prefix:   /
  
  app:
      resource: "@AppBundle/Controller/"
      type:     annotation
  
  login.:
      path: /login
      defaults: { _controller: F3ILCocktailBundle:Security:login}
  
  login_check:
      path: /login_check
  
  logout:
      path:   /logout
  </code></pre>
  
  <p>Once connected, I want the user to go on the route <code>admin_recette_new</code>, but nothing is work. Always got : </p>
  
  <pre><code>Invalid credentials,
  Bad credentials.
  </code></pre>
  
  <p>Even when all the credentials are correct. Please what's wrong ?</p>