public function process_login_fb()
 {
     $email = $_SESSION['sementara']['admin_email'];
     $fbid = $_SESSION['sementara']['admin_fb_id'];
     if ($fbid == "" || $email == "") {
         Redirect::loginFailed();
     }
     $arr = $this->getWhere("admin_email = '{$email}' AND admin_fb_id='{$fbid}' AND admin_aktiv = 1 ");
     if (count($arr) > 0) {
         //load by login ID
         $obj = $arr[0];
         $row = toRow($obj);
         $this->fill($row);
         if (isset($this->admin_id)) {
             $_SESSION["admin_session"] = 1;
             $_SESSION["account"] = $obj;
             //Update setlastlogin
             self::setLastUpdate($_SESSION["account"]->admin_id);
             //lanjut
             //loading metadata
             $meta = new AccountMeta();
             $meta->getMeta($this->admin_id);
             //now loading roles
             $this->loadRole();
             //set cookie
             Auth::setCookie($this->rememberme, $this->admin_id, $this->admin_email, $this->admin_password);
             //kalau sukses
             if (Auth::isLogged()) {
                 //load school setting
                 // $ss = new Schoolsetting();
                 // $ss->loadToSession();
                 //redirect
                 //Account::setRedirection ();
                 $acl = new AccountLogin();
                 Hook::processHook($acl->login_hook);
                 //login hook doesnt seem to work =>bypass
                 $qp = new QuizPoints();
                 $qp->getPoints();
                 $qp->saveUnsaved();
                 Redirect::firstPage();
             } else {
                 Redirect::loginFailed();
             }
         } else {
             return 0;
         }
     }
 }
Example #2
0
 public static function login($row)
 {
     /*
      * load by Username
      */
     $acc = new Account();
     $acc->fill($row);
     if ($acc->loadByUserLogin()) {
         //login succesfull
         //loading metadata
         $meta = new AccountMeta();
         $meta->getMeta($acc->admin_id);
         //now loading roles
         $acc->loadRole();
         //set cookie
         self::setCookie($acc->rememberme, $acc->admin_id, $acc->admin_email, $acc->admin_password);
         //Redirect::firstPage();
     } else {
         Redirect::loginFailed();
     }
 }