public function ConnectUser()
 {
     // get the username and password
     $this->username = Openbiz::$app->getClientProxy()->getFormInputs("fld_username");
     $this->password = Openbiz::$app->getClientProxy()->getFormInputs("fld_password");
     $eventlog = Openbiz::getService(OPENBIZ_EVENTLOG_SERVICE);
     try {
         if ($this->authUser()) {
             // after authenticate user: 1. init profile
             $profile = Openbiz::$app->InitUserProfile($this->username);
             $OauthUserInfo = Openbiz::$app->getSessionContext()->getVar('_OauthUserInfo');
             if (!$OauthUserInfo || !$profile['Id']) {
                 $this->errors = array($this->getMessage("TEST_FAILURE"));
                 $this->updateForm();
                 return false;
             }
             include_once Openbiz::$app->getModulePath() . "/oauth/libs/oauth.class.php";
             $OauthObj = new oauthClass();
             if (!$OauthObj->saveUserOAuth($profile['Id'], $OauthUserInfo)) {
                 $this->errors = array("fld_password" => $this->getMessage("ASSOCIATED_USER_FAILS"));
                 $this->updateForm();
                 return false;
             } else {
                 //Openbiz::$app->getClientProxy()->showClientAlert($this->getMessage("ASSOCIATED_USER_SUCCESS"));
             }
             $this->switchForm("oauth.form.OauthConnectUserFinishedForm");
             /*
              $redirectPage = OPENBIZ_APP_INDEX_URL.$profile['roleStartpage'][0];
              if(!$profile['roleStartpage'][0])
              {
              Openbiz::$app->getClientProxy()->showClientAlert($this->getMessage("TEST_FAILURE"));
              return false;
              }
             
              if($profile['roleStartpage'][0]){
              Openbiz::$app->getClientProxy()->ReDirectPage($redirectPage);
              }else{
              parent::processPostAction();
              }
             */
             return true;
         } else {
             $logComment = array($this->username, $_SERVER['REMOTE_ADDR'], $this->password);
             $eventlog->log("LOGIN", "ASSOCIATED_LOGIN_FAILED", $logComment);
             $this->errors = array("fld_username" => $this->getMessage("ASSOCIATED_USER_FAILS"), "fld_password" => " ");
             $this->updateForm();
             return false;
         }
     } catch (Exception $e) {
         Openbiz::$app->getClientProxy()->showClientAlert($e->getMessage());
     }
 }