Authored by Rock Zhang

修复第三方登录失败的bug(转换回调链接错误导致)

Code Review By Rock Zhang
... ... @@ -918,4 +918,15 @@ class Helpers
$sort = $desc == false ? SORT_ASC : SORT_DESC;
array_multisort($fieldArr, $sort, $array, $sortType);
}
/**
* 将首字符为//的url转换为http://
*
* @param string $url 需要转换的url
* @return mixed
*/
public static function transHttpsUrl($url)
{
return preg_replace('/^\/\//', 'http://', $url);
}
}
... ...
... ... @@ -16,5 +16,5 @@ return array(
// 访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http
'transport' => 'http',
// 页面跳转同步通知页面路径 (需http://格式的完整路径,不允许加?id=123这类自定义参数)
'return_url' => SITE_MAIN . '/passport/login/alipaycallback',
'return_url' => \Plugin\Helpers::transUrl(SITE_MAIN) . '/passport/login/alipaycallback',
);
... ...
... ... @@ -5,7 +5,7 @@ defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']);
return array(
'appid' => '100229394',
'appkey' => 'c0af9c29e0900813028c2ccb42021792',
'callback' => strtr(SITE_MAIN, array('//' => 'http://')) . '/passport/login/qqcallback',
'callback' => \Plugin\Helpers::transUrl(SITE_MAIN) . '/passport/login/qqcallback',
'scope' => 'get_user_info,add_share,upload_pic,get_idollist,get_fanslist',
'errorReport' => true,
);
... ...
... ... @@ -5,5 +5,5 @@ defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']);
return array(
'appId' => '3739328910',
'appKey' => '9d44cded26d048e23089e5e975c93df1',
'appCallbackUrl' => strtr(SITE_MAIN, array('//' => 'http://')) . '/passport/login/sinacallback',
'appCallbackUrl' => \Plugin\Helpers::transUrl(SITE_MAIN) . '/passport/login/sinacallback',
);
... ...