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());
     }
 }
Esempio n. 2
0
 public function __construct()
 {
     parent::__construct();
     $recArr = $this->getProviderList();
     $this->akey = $recArr['key'];
     $this->skey = $recArr['value'];
 }
Esempio n. 3
0
 public function __construct()
 {
     parent::__construct();
     $recArr = $this->getProviderList();
     $this->akey = $recArr['key'];
     $this->skey = $recArr['value'];
     $this->facebook = new FacebookApi(array('appId' => $this->akey, 'secret' => $this->skey, 'CallBack' => $this->callBack));
 }
Esempio n. 4
0
 public function __construct()
 {
     parent::__construct();
     $recArr = $this->getProviderList();
     $this->sina_akey = $recArr['key'];
     $this->sina_skey = $recArr['value'];
     $this->sina = new SaeTOAuthV2($this->sina_akey, $this->sina_skey);
 }
Esempio n. 5
0
 public function __construct()
 {
     parent::__construct();
     $recArr = $this->getProviderList();
     $this->akey = $recArr['key'];
     $this->skey = $recArr['value'];
     $this->google = new apiClient();
     $this->google->setClientId($recArr['key']);
     $this->google->setClientSecret($recArr['value']);
     $this->google->setRedirectUri($this->callBack);
 }
Esempio n. 6
0
 public function __construct()
 {
     parent::__construct();
     $recArr = $this->getProviderList();
     $this->akey = $recArr['key'];
     $this->skey = $recArr['value'];
     $aliapy_config['partner'] = $recArr['key'];
     //安全检验码,以数字和字母组成的32位字符
     $aliapy_config['key'] = $recArr['value'];
     //页面跳转同步通知页面路径,要用 http://格式的完整路径,不允许加?id=123这类自定义参数
     //return_url的域名不能写成http://localhost/alipay.auth.authorize_php_utf8/return_url.php ,否则会导致return_url执行无效
     $aliapy_config['return_url'] = $this->callBack;
     //签名方式 不需修改
     $aliapy_config['sign_type'] = 'MD5';
     //字符编码格式 目前支持 gbk 或 utf-8
     $aliapy_config['input_charset'] = 'utf-8';
     //访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http
     $aliapy_config['transport'] = 'http';
     $aliapy_config['service'] = 'alipay.auth.authorize';
     $aliapy_config['target_service'] = 'user.auth.quick.login';
     $aliapy_config['type'] = 'get';
     $this->aliapy_config = $aliapy_config;
     $this->parameter = array("service" => "alipay.auth.authorize", "target_service" => 'user.auth.quick.login', "partner" => trim($this->aliapy_config['partner']), "_input_charset" => trim(strtolower($this->aliapy_config['input_charset'])), "return_url" => trim($this->aliapy_config['return_url']));
 }