소셜로그인 세션 관련 수정
This commit is contained in:
1 parent
25bce8592d
commit
604531906a
5 files changed
+29
-6
No files matched your search
@@ -91,7 +91,7 @@ function social_login_get_provider_adapter( $provider )
|
||||
$g5['hybrid_auth'] = new Hybrid_Auth( $setting );
|
||||
}
|
||||
|
||||
$newsession = $g5['hybrid_auth']->getSessionData();
|
||||
//$newsession = $g5['hybrid_auth']->getSessionData();
|
||||
|
||||
if( defined('G5_SOCIAL_LOGIN_START_PARAM') && G5_SOCIAL_LOGIN_START_PARAM === 'hauth.start' && G5_SOCIAL_LOGIN_DONE_PARAM === 'hauth.done' ){
|
||||
return $g5['hybrid_auth']->authenticate($provider);
|
||||
@@ -433,6 +433,18 @@ if( !function_exists('replaceQueryParams') ){
|
||||
}
|
||||
}
|
||||
|
||||
function social_loading_provider_page( $provider ){
|
||||
|
||||
social_login_session_clear(1);
|
||||
|
||||
define('G5_SOCIAL_IS_LOADING', TRUE );
|
||||
|
||||
$login_action_url = G5_URL;
|
||||
|
||||
$img_url = G5_SOCIAL_LOGIN_URL.'/img/';
|
||||
include_once(G5_SOCIAL_LOGIN_PATH.'/includes/loading.php');
|
||||
}
|
||||
|
||||
function social_check_login_before($p_service=''){
|
||||
global $is_member, $member;
|
||||
|
||||
@@ -445,6 +457,11 @@ function social_check_login_before($p_service=''){
|
||||
|
||||
if( $provider_name ){
|
||||
|
||||
if( ! isset( $_REQUEST["redirect_to_idp"] ) )
|
||||
{
|
||||
return social_loading_provider_page( $provider_name );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$adapter = social_login_get_provider_adapter( $provider_name );
|
||||
@@ -519,6 +536,11 @@ function social_check_login_before($p_service=''){
|
||||
if( is_object( $adapter ) ){ //연결한것은 인증 받은 즉시 로그아웃한다.
|
||||
social_logout_with_adapter($adapter);
|
||||
}
|
||||
|
||||
// 세션에 소셜정보가 없으면 연결된 소셜서비스를 저장합니다.
|
||||
if( ! get_session('ss_social_provider') ){
|
||||
set_session('ss_social_provider', $provider_name);
|
||||
}
|
||||
|
||||
if( $use_popup == 1 || ! $use_popup ){ //팝업이면
|
||||
?>
|
||||
|
||||
@@ -21,7 +21,7 @@ if (!defined('_GNUBOARD_')) exit;
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php if( G5_SOCIAL_USE_POPUP && empty($login_action_url) ){ ?>
|
||||
<?php if( (defined('G5_SOCIAL_IS_LOADING') && G5_SOCIAL_IS_LOADING ) || (G5_SOCIAL_USE_POPUP && empty($login_action_url)) ){ ?>
|
||||
<script>
|
||||
window.location.href = window.location.href + "&redirect_to_idp=1";
|
||||
</script>
|
||||
|
||||
@@ -38,6 +38,7 @@ if( isset( $_REQUEST["redirect_to_idp"] ) ){
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
social_login_session_clear(1);
|
||||
social_return_from_provider_page( $provider_name, '', '', '', '' );
|
||||
}
|
||||
?>
|
||||
@@ -23,14 +23,14 @@ if( ! $user_profile ){
|
||||
$is_exists_social_account = social_before_join_check($url);
|
||||
|
||||
$user_nick = social_relace_nick($user_profile->displayName);
|
||||
$user_email = ($user_profile->emailVerified) ? $user_profile->emailVerified : $user_profile->email;
|
||||
$user_email = isset($user_profile->emailVerified) ? $user_profile->emailVerified : $user_profile->email;
|
||||
$user_id = $user_profile->sid ? preg_replace("/[^0-9a-z_]+/i", "", $user_profile->sid) : get_social_convert_id($user_profile->identifier, $provider_name);
|
||||
|
||||
//$is_exists_id = exist_mb_id($user_id);
|
||||
//$is_exists_name = exist_mb_nick($user_nick, '');
|
||||
$user_id = exist_mb_id_recursive($user_id);
|
||||
$user_nick = exist_mb_nick_recursive($user_nick, '');
|
||||
$is_exists_email = exist_mb_email($user_email, '');
|
||||
$is_exists_email = $user_email ? exist_mb_email($user_email, '') : false;
|
||||
|
||||
// 불법접근을 막도록 토큰생성
|
||||
$token = md5(uniqid(rand(), true));
|
||||
|
||||
@@ -34,8 +34,8 @@ if( $row['mp_no'] ){
|
||||
|
||||
social_member_link_delete($mb_id, $row['mp_no']);
|
||||
|
||||
if( $mb_id == $row['mb_id'] ){
|
||||
//social_provider_logout($provider, 0);
|
||||
if( $provider === get_session('ss_social_provider') ){
|
||||
set_session('ss_social_provider', '');
|
||||
}
|
||||
|
||||
die("{\"error\":\"\", \"mp_no\":".$row['mp_no']."}");
|
||||
|
||||
Reference in new issue
Block a user