/**
  * The authenticate action has to be triggered through an HTTP POST Request, only if the user agent
  * comes directly from the index (login form) action.
  *
  * @param string $username The username provided through the login form.
  * @param string $password The password provided through the login form.
  * @param string $ref The action where the user-agent has to be redirect if the authentication process is a success.
  */
 public function authenticate($username, $password, $ref, $openid)
 {
     if (!empty($openid)) {
         $oid = new Openid();
         $oid->try_auth($openid);
         exit;
     }
     Auth::login($username, $password);
     if (Auth::isAuth()) {
         // Authentication process succeeded.
         // We log the connection if necessary.
         // FIXME Use a real log library to log messages.
         if (LOGS_USERS) {
             $this->logConnection();
         }
         // Redirection in the portal.
         DefaultFC::redirection($ref);
         exit;
     } else {
         # log user to the anonymous account
         //$_SESSION['isError'] = true;
         //$_SESSION['message'] = __("Wrong login or password. Please try again.");
         Auth::login('anonymous', 'anonymous');
         DefaultFC::redirection('wall/index');
         DefaultFC::redirection('users/index');
         exit;
     }
 }