Exemple #1
0
 function processInternal($urlRewrite)
 {
     $showError = false;
     if (isset($_POST['login'])) {
         $username = $_POST[FIELD_USERNAME];
         $password = $_POST[FIELD_PASSWORD];
         $user = $this->login($username, $password);
         if ($user != null) {
             $_SESSION['user'] = $user;
             if (isset($_POST[FIELD_REMEMBERME])) {
                 $this->handleRememberMe($user);
             }
         } else {
             $showError = true;
         }
     }
     if (isset($_GET['logout']) && parent::isLoggedIn()) {
         //unset cookie
         setcookie(COOKIE_HASH, "", 0);
         unset($_SESSION['user']);
     }
     if (parent::isLoggedIn()) {
         //redirect to the dashboard
         header('Location: ' . $urlRewrite->r('entry.php?t=dashboard'));
         return array('render' => false);
     } else {
         //display the login page
         return array('render' => true, 'showError' => $showError);
     }
 }