Пример #1
0
 public function authenticate()
 {
     global $SESSION;
     $username = $this->input->post("login_username");
     $user_pass = $this->input->post("login_password");
     if (!$username || !$user_pass) {
         if (!$username) {
             return $this->showForm(0, "Informe seu usuário!");
         }
         if (!$user_pass) {
             return $this->showForm(0, "Informe sua senha!");
         }
     }
     include "User.php";
     $user = new User(0);
     $trying = $user->tryLogin($username, md5($user_pass));
     if ($trying["is_authenticated"]) {
         FUTURI_Session::set("futuri_logged", true);
         $user->setID($trying["user_data"]["id"]);
         FUTURI_Session::set("user_info", $user->fields);
         SystemHelper::executeJavascript("localStorage.setItem('FUTURI_user_id','" . $user->fields['id'] . "');");
         if ($user->fields['tour_visto']) {
             SystemHelper::executeJavascript("window.location = '" . base_url() . "inicio" . "'");
         } else {
             SystemHelper::executeJavascript("window.location = '" . base_url() . "tour" . "'");
         }
     } else {
         $this->showForm(0, "Usuário e/ou senha incorretos!");
     }
 }
Пример #2
0
 public function afterUpdate()
 {
     $this->afterAdd();
     if ($this->fields['id'] == FUTURI_Session::getUserID()) {
         FUTURI_Session::set("user_info", $this->fields);
     }
 }