Beispiel #1
0
 public function ProcessLogin()
 {
     $email = $this->post->email;
     $password = $this->post->password;
     if ($email == '' || $password == '') {
         $this->set('message', 'You must fill out both your username and password');
         $this->render('login_form.tpl');
         return false;
     }
     if (!Auth::ProcessLogin($email, $password)) {
         $this->set('message', Auth::$error_message);
         $this->render('login_form.tpl');
         return false;
     } else {
         if (Auth::$pilot->confirmed == PILOT_PENDING) {
             $this->render('login_unconfirmed.tpl');
             Auth::LogOut();
             // show error
         } elseif (Auth::$pilot->confirmed == PILOT_REJECTED) {
             $this->render('login_rejected.tpl');
             Auth::LogOut();
         } else {
             $pilotid = Auth::$pilot->pilotid;
             $session_id = Auth::$session_id;
             # If they choose to be "remembered", then assign a cookie
             if ($this->post->remember == 'on') {
                 $cookie = "{$session_id}|{$pilotid}|{$_SERVER['REMOTE_ADDR']}";
                 $res = setrawcookie(VMS_AUTH_COOKIE, $cookie, time() + Config::Get('SESSION_LOGIN_TIME'), '/');
             }
             PilotData::updateLogin($pilotid);
             CodonEvent::Dispatch('login_success', 'Login');
             $this->post->redir = str_replace('index.php/', '', $this->post->redir);
             header('Location: ' . url('/' . $this->post->redir));
         }
         return;
     }
 }