src/Controller/UserController.php
public function LoginAction()
  {
    // Checks if the form has been completed
    if (!empty($_POST))
    {
      // Search the user in the DB
      $user = ModelFactory::get('User')->read($_POST['email'], 'email');

      // Checks if the password is correct
      if (password_verify($_POST['pass'], $user['pass']))
      {
        // Creates the user session
        Session::createSession(
          $user['id'],
          $user['first_name'],
          $user['image'],
          $user['email']
        );
        // Creates a custom message to welcome the user
        htmlspecialchars(Session::createAlert('Successful authentication, welcome ' . $user['first_name'] .' !', 'special'));

        // Redirects to the view home
        $this->redirect('home');
      }
      else {
        // Creates an authentification fail message
        htmlspecialchars(Session::createAlert('Failed authentication !', 'cancel'));
      }
    }
    // Returns the rendering of the view loginUser
    return $this->render('user/loginUser.twig');
  }
public function LoginAction()
  {
    // Checks if the form has been completed
    if (!empty($_POST))
    {
      // Search the user in the DB
      $user = ModelFactory::get('User')->read($_POST['email'], 'email');

      // Checks if the password is correct
      if (password_verify($_POST['pass'], $user['pass']))
      {
        // Creates the user session
        Session::createSession(
          $user['id'],
          $user['first_name'],
          $user['image'],
          $user['email']
        );
        // Creates a custom message to welcome the user
        htmlspecialchars(Session::createAlert('Successful authentication, welcome ' . $user['first_name'] .' !', 'special'));

        // Redirects to the view home
        $this->redirect('home');
      }
      else {
        // Creates an authentification fail message
        htmlspecialchars(Session::createAlert('Failed authentication !', 'cancel'));
      }
    }
    // Returns the rendering of the view loginUser
    return $this->render('user/loginUser.twig');
  }
*******************************************************\
Checks if the user is registred & if his password matches
Then connects him if it's alright
Otherwise, display the login form
@return mixed => the rendering of the login form page