diff --git a/mobile/skin/social/social_register_member.skin.php b/mobile/skin/social/social_register_member.skin.php
index a640266ab..8ace898d3 100644
--- a/mobile/skin/social/social_register_member.skin.php
+++ b/mobile/skin/social/social_register_member.skin.php
@@ -91,13 +91,6 @@ $email_msg = $is_exists_email ? '등록할 이메일이 중복되었습니다.
-
-
-
-
-
-
-
diff --git a/plugin/social/Hybrid/Providers/Kakao.php b/plugin/social/Hybrid/Providers/Kakao.php
index 24effe868..12955de21 100644
--- a/plugin/social/Hybrid/Providers/Kakao.php
+++ b/plugin/social/Hybrid/Providers/Kakao.php
@@ -73,7 +73,7 @@ class Hybrid_Providers_Kakao extends Hybrid_Provider_Model_OAuth2
function getUserProfile()
{
//$params = array('property_keys'=>'kaccount_email'); // v1 parameter
- $params = array('property_keys'=>array('kakao_account.email')); // v2 parameter
+ $params = array('property_keys'=>json_encode(array('kakao_account.profile', 'kakao_account.email', 'kakao_account.phone_number'))); // v2 parameter
$this->api->decode_json = false;
$this->api->curl_header = array( 'Authorization: Bearer ' . $this->api->access_token );
@@ -85,8 +85,11 @@ class Hybrid_Providers_Kakao extends Hybrid_Provider_Model_OAuth2
}
# store the user profile.
$this->user->profile->identifier = @ $data->id;
- $this->user->profile->displayName = @ $data->properties->nickname;
- $this->user->profile->photoURL = @ $data->properties->thumbnail_image;
+ $this->user->profile->displayName = isset($data->kakao_account->profile->nickname) ? $data->kakao_account->profile->nickname : '';
+ $this->user->profile->photoURL = isset($data->kakao_account->profile->thumbnail_image_url) ? $data->kakao_account->profile->thumbnail_image_url : '';
+ $phone = isset($data->kakao_account->phone_number) ? $data->kakao_account->phone_number : '';
+ // 국내 국가번호를 제거하고 생략된 맨 앞의 0을 복원한다.
+ $this->user->profile->phone = preg_replace('/^\+82[\s-]*0?/', '0', trim($phone));
//$email = @ $data->properties->kaccount_email; // v1 version
$email = @ $data->kakao_account->email; // v2 version
diff --git a/plugin/social/Hybrid/Providers/Naver.php b/plugin/social/Hybrid/Providers/Naver.php
index b0302f2b8..44e676784 100644
--- a/plugin/social/Hybrid/Providers/Naver.php
+++ b/plugin/social/Hybrid/Providers/Naver.php
@@ -26,7 +26,7 @@ class Hybrid_Providers_Naver extends Hybrid_Provider_Model_OAuth2
parent::initialize();
// Provider API end-points
- $this->api->api_base_url = "https://apis.naver.com/nidlogin/";
+ $this->api->api_base_url = "https://openapi.naver.com/v1/";
$this->api->authorize_url = "https://nid.naver.com/oauth2.0/authorize";
$this->api->token_url = "https://nid.naver.com/oauth2.0/token";
@@ -102,18 +102,18 @@ class Hybrid_Providers_Naver extends Hybrid_Provider_Model_OAuth2
//https://developers.naver.com/docs/login/profile/
function getUserProfile()
{
- $response = $this->profile("nid/getUserProfile.xml");
+ $response = $this->profile("nid/me");
+ $profile = json_decode($response, true);
- $xml = @ new SimpleXMLElement($response);
- $data = array();
- if ( $xml->result[0]->resultcode == '00' ) {
- foreach ($xml->response->children() as $response => $k) {
- $data[(string)$response] = (string) $k;
- }
- } else {
+ if (!is_array($profile) || !isset($profile['resultcode']) || $profile['resultcode'] !== '00'
+ || !isset($profile['response']) || !is_array($profile['response'])
+ || !isset($profile['response']['id']) || !is_string($profile['response']['id'])
+ || $profile['response']['id'] === '') {
throw new Exception("User profile request failed! {$this->providerId} returned an invalid response.", 6);
}
+ $data = $profile['response'];
+
# store the user profile.
//$this->user->profile->identifier = (array_key_exists('enc_id',$data))?$data['enc_id']:"";
$this->user->profile->identifier = (array_key_exists('id',$data))?$data['id']:"";
@@ -139,6 +139,7 @@ class Hybrid_Providers_Naver extends Hybrid_Provider_Model_OAuth2
}
$this->user->profile->email = (array_key_exists('email',$data))?$data['email']:"";
$this->user->profile->emailVerified = (array_key_exists('email',$data))?$data['email']:"";
+ $this->user->profile->phone = (array_key_exists('mobile', $data)) ? $data['mobile'] : '';
$this->user->profile->gender = (array_key_exists('gender',$data))?(($data['gender'] == "M")?"male":"female"):"";
$this->user->profile->photoURL = (array_key_exists('profile_image',$data))?$data['profile_image']:"";
diff --git a/plugin/social/register_member.php b/plugin/social/register_member.php
index 1d9929af3..72b4eba42 100644
--- a/plugin/social/register_member.php
+++ b/plugin/social/register_member.php
@@ -25,7 +25,8 @@ $is_exists_social_account = social_before_join_check($url);
$user_nick = social_relace_nick($user_profile->displayName);
$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);
-$user_phone = $user_profile->phone;
+$user_phone = isset($user_profile->phone) ? $user_profile->phone : '';
+$user_phone = valid_mb_hp($user_phone) ? '' : hyphen_hp_number($user_phone);
if(! $user_nick) {
$tmp = explode('_', $user_id);
diff --git a/plugin/social/register_member_update.php b/plugin/social/register_member_update.php
index eb7c8dbf7..790f3b403 100644
--- a/plugin/social/register_member_update.php
+++ b/plugin/social/register_member_update.php
@@ -31,7 +31,17 @@ $mb_password_re = isset($_POST['mb_password_re']) ? trim($_POST['mb_password_re'
$mb_nick = isset($_POST['mb_nick']) ? trim(strip_tags($_POST['mb_nick'])) : '';
$mb_email = isset($_POST['mb_email']) ? trim($_POST['mb_email']) : '';
$mb_name = isset($_POST['mb_name']) ? addslashes(clean_xss_tags(trim(strip_tags(stripslashes($_POST['mb_name']))))) : '';
-$mb_hp = isset($_POST['mb_hp']) ? trim($_POST['mb_hp']) : '';
+// 입력값이 없는 기존 스킨에서도 동의하여 제공받은 휴대폰번호를 활용한다.
+$profile_phone = isset($user_profile->phone) ? $user_profile->phone : '';
+$profile_phone = valid_mb_hp($profile_phone) ? '' : $profile_phone;
+if (isset($_POST['mb_hp']) && !is_string($_POST['mb_hp'])) {
+ alert('휴대폰번호를 올바르게 입력해 주십시오.', '', true, true);
+}
+$mb_hp = isset($_POST['mb_hp']) ? trim($_POST['mb_hp']) : $profile_phone;
+if ($config['cf_req_hp'] || $mb_hp !== '') {
+ if ($msg = valid_mb_hp($mb_hp)) alert($msg, '', true, true);
+}
+$mb_hp = hyphen_hp_number($mb_hp);
$mb_email = get_email_address($mb_email);
// 이름, 닉네임에 utf-8 이외의 문자가 포함됐다면 오류
@@ -141,8 +151,10 @@ if (!empty($agree_items)) {
//===============================================================
// 본인확인
//---------------------------------------------------------------
+$sql_certify = '';
+$md5_cert_no = '';
+$cert_type = '';
if($config['cf_cert_use']) {
- $mb_hp = hyphen_hp_number($mb_hp);
if($config['cf_cert_use'] && get_session('ss_cert_type') && get_session('ss_cert_dupinfo')) {
// 중복체크
$sql = " select mb_id from {$g5['member_table']} where mb_id <> '{$member['mb_id']}' and mb_dupinfo = '".get_session('ss_cert_dupinfo')."' ";
@@ -158,7 +170,6 @@ if($config['cf_cert_use']) {
if ($config['cf_cert_use'] && $cert_type && $md5_cert_no) {
// 해시값이 같은 경우에만 본인확인 값을 저장한다.
if ($cert_type == 'ipin' && get_session('ss_cert_hash') == md5($mb_name.$cert_type.get_session('ss_cert_birth').$md5_cert_no)) { // 아이핀일때 hash 값 체크 hp미포함
- $sql_certify .= " , mb_hp = '{$mb_hp}' ";
$sql_certify .= " , mb_certify = '{$cert_type}' ";
$sql_certify .= " , mb_adult = '".get_session('ss_cert_adult')."' ";
$sql_certify .= " , mb_birth = '".get_session('ss_cert_birth')."' ";
@@ -167,7 +178,6 @@ if($config['cf_cert_use']) {
if($w == 'u')
$sql_certify .= " , mb_name = '{$mb_name}' ";
} else if($cert_type != 'ipin' && get_session('ss_cert_hash') == md5($mb_name.$cert_type.get_session('ss_cert_birth').$mb_hp.$md5_cert_no)) { // 간편인증, 휴대폰일때 hash 값 체크 hp포함
- $sql_certify .= " , mb_hp = '{$mb_hp}' ";
$sql_certify .= " , mb_certify = '{$cert_type}' ";
$sql_certify .= " , mb_adult = '".get_session('ss_cert_adult')."' ";
$sql_certify .= " , mb_birth = '".get_session('ss_cert_birth')."' ";
@@ -180,7 +190,6 @@ if($config['cf_cert_use']) {
}
} else {
if (get_session("ss_reg_mb_name") != $mb_name || get_session("ss_reg_mb_hp") != $mb_hp) {
- $sql_certify .= " , mb_hp = '{$mb_hp}' ";
$sql_certify .= " , mb_certify = '' ";
$sql_certify .= " , mb_adult = 0 ";
$sql_certify .= " , mb_birth = '' ";
@@ -197,6 +206,7 @@ $sql = " insert into {$g5['member_table']}
mb_nick = '{$mb_nick}',
mb_nick_date = '".G5_TIME_YMD."',
mb_email = '{$mb_email}',
+ mb_hp = '{$mb_hp}',
mb_email_certify = '".$mb_email_certify."',
mb_today_login = '".G5_TIME_YMDHIS."',
mb_datetime = '".G5_TIME_YMDHIS."',
diff --git a/skin/social/social_register_member.skin.php b/skin/social/social_register_member.skin.php
index 5845fb1d6..186546e51 100644
--- a/skin/social/social_register_member.skin.php
+++ b/skin/social/social_register_member.skin.php
@@ -83,13 +83,6 @@ $email_msg = $is_exists_email ? '등록할 이메일이 중복되었습니다.
-
-
-
-
-
-
-