diff --git a/plugin/social/includes/functions.php b/plugin/social/includes/functions.php index 0de274e81..5577ed83c 100644 --- a/plugin/social/includes/functions.php +++ b/plugin/social/includes/functions.php @@ -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 ){ //팝업이면 ?> diff --git a/plugin/social/includes/loading.php b/plugin/social/includes/loading.php index aeafe2723..61a428427 100644 --- a/plugin/social/includes/loading.php +++ b/plugin/social/includes/loading.php @@ -21,7 +21,7 @@ if (!defined('_GNUBOARD_')) exit; - + diff --git a/plugin/social/popup.php b/plugin/social/popup.php index 1009e0ec7..4946df8be 100644 --- a/plugin/social/popup.php +++ b/plugin/social/popup.php @@ -38,6 +38,7 @@ if( isset( $_REQUEST["redirect_to_idp"] ) ){ \ No newline at end of file diff --git a/plugin/social/register_member.php b/plugin/social/register_member.php index c1ea1dbee..4451c3b61 100644 --- a/plugin/social/register_member.php +++ b/plugin/social/register_member.php @@ -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)); diff --git a/plugin/social/unlink.php b/plugin/social/unlink.php index ac20bc837..5d20bebe4 100644 --- a/plugin/social/unlink.php +++ b/plugin/social/unlink.php @@ -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']."}");