mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 10:11:38 +09:00
Enable login by phone number
This commit is contained in:
parent
584b274874
commit
2029a6357e
4 changed files with 52 additions and 26 deletions
|
|
@ -34,6 +34,7 @@ $lang->group_order_change = 'Change Group Priority';
|
|||
$lang->phone_number_default_country = 'Default Country Code';
|
||||
$lang->phone_number_hide_country = 'Hide Country Code Selection';
|
||||
$lang->phone_number_allow_duplicate = 'Allow Multiple Members';
|
||||
$lang->msg_need_default_country = 'You must select a default country code if you want to hide the country code selection box.';
|
||||
$lang->signature = 'Signature';
|
||||
$lang->profile_image = 'Profile Image';
|
||||
$lang->profile_image_max_width = 'Max Width';
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ $lang->group_order_change = '그룹 우선순위 변경';
|
|||
$lang->phone_number_default_country = '기본 선택 국가';
|
||||
$lang->phone_number_hide_country = '국가 목록 숨김';
|
||||
$lang->phone_number_allow_duplicate = '중복 가입 허용';
|
||||
$lang->msg_need_default_country = '국가 목록을 숨기려면 기본 선택 국가가 있어야 합니다.';
|
||||
$lang->signature = '서명';
|
||||
$lang->profile_image = '프로필 사진';
|
||||
$lang->profile_image_max_width = '가로 제한 길이';
|
||||
|
|
|
|||
|
|
@ -333,6 +333,11 @@ class memberAdminController extends member
|
|||
$args->phone_number_default_country = preg_replace('/[^0-9-]/', '', $args->phone_number_default_country);
|
||||
$args->phone_number_hide_country = $args->phone_number_hide_country == 'Y' ? 'Y' : 'N';
|
||||
$args->phone_number_allow_duplicate = $args->phone_number_allow_duplicate == 'Y' ? 'Y' : 'N';
|
||||
if ($args->phone_number_hide_country === 'Y' && !$args->phone_number_default_country)
|
||||
{
|
||||
return new BaseObject('-1', 'msg_need_default_country');
|
||||
}
|
||||
|
||||
$args->profile_image = $args->profile_image ? 'Y' : 'N';
|
||||
$args->image_name = $args->image_name ? 'Y' : 'N';
|
||||
$args->image_mark = $args->image_mark ? 'Y' : 'N';
|
||||
|
|
|
|||
|
|
@ -732,14 +732,7 @@ class memberController extends member
|
|||
// Log-in
|
||||
if($config->enable_confirm != 'Y')
|
||||
{
|
||||
if($config->identifier == 'email_address')
|
||||
{
|
||||
$output = $this->doLogin($args->email_address);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = $this->doLogin($args->user_id);
|
||||
}
|
||||
$output = $this->doLogin($args->{$config->identifier});
|
||||
if(!$output->toBool()) {
|
||||
if($output->error == -9)
|
||||
$output->error = -11;
|
||||
|
|
@ -2138,20 +2131,54 @@ class memberController extends member
|
|||
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
// check identifier
|
||||
if($config->identifier == 'email_address' || strpos($user_id, '@') !== false)
|
||||
if((!$config->identifiers || in_array('email_address', $config->identifiers)) && strpos($user_id, '@') !== false)
|
||||
{
|
||||
// Get user_id information
|
||||
$member_info = $oMemberModel->getMemberInfoByEmailAddress($user_id);
|
||||
// Set an invalid user if no value returned
|
||||
if(!$user_id || strtolower($member_info->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address');
|
||||
if(!$user_id || strtolower($member_info->email_address) !== strtolower($user_id))
|
||||
{
|
||||
return $this->recordLoginError(-1, 'invalid_email_address');
|
||||
}
|
||||
|
||||
}
|
||||
elseif($config->identifiers && in_array('phone_number', $config->identifiers) && strpos($user_id, '@') === false)
|
||||
{
|
||||
if(preg_match('/^\+([0-9-]+)\.([0-9.-]+)$/', $user_id, $matches))
|
||||
{
|
||||
$phone_country = preg_replace('/[^0-9]/', '', $matches[1]);
|
||||
$user_id = preg_replace('/[^0-9]/', '', $matches[2]);
|
||||
}
|
||||
elseif($config->phone_number_default_country)
|
||||
{
|
||||
$phone_country = $config->phone_number_default_country;
|
||||
$user_id = preg_replace('/[^0-9]/', '', $user_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->recordLoginError(-1, 'invalid_user_id');
|
||||
}
|
||||
|
||||
if($config->phone_number_hide_country)
|
||||
{
|
||||
$phone_country = $config->phone_number_default_country;
|
||||
}
|
||||
|
||||
$member_info = $oMemberModel->getMemberInfoByPhoneNumber($user_id, $phone_country);
|
||||
if(!$user_id || strtolower($member_info->phone_number) !== $user_id)
|
||||
{
|
||||
return $this->recordLoginError(-1, 'invalid_user_id');
|
||||
}
|
||||
}
|
||||
elseif(!$config->identifiers || in_array('user_id', $config->identifiers))
|
||||
{
|
||||
$member_info = $oMemberModel->getMemberInfoByUserID($user_id);
|
||||
if(!$user_id || strtolower($member_info->user_id) !== strtolower($user_id))
|
||||
{
|
||||
return $this->recordLoginError(-1, 'invalid_user_id');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get user_id information
|
||||
$member_info = $oMemberModel->getMemberInfoByUserID($user_id);
|
||||
// Set an invalid user if no value returned
|
||||
if(!$user_id || strtolower($member_info->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id');
|
||||
return $this->recordLoginError(-1, 'invalid_user_id');
|
||||
}
|
||||
|
||||
$output = executeQuery('member.getLoginCountByIp', $args);
|
||||
|
|
@ -2544,14 +2571,10 @@ class memberController extends member
|
|||
}
|
||||
if ($args->phone_country == '82')
|
||||
{
|
||||
if (Rhymix\Framework\Korea::isValidPhoneNumber($args->phone_number))
|
||||
if (!Rhymix\Framework\Korea::isValidPhoneNumber($args->phone_number))
|
||||
{
|
||||
$args->phone_number = Rhymix\Framework\Korea::formatPhoneNumber($args->phone_number);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new BaseObject(-1, 'msg_invalid_phone_number');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -2773,11 +2796,7 @@ class memberController extends member
|
|||
}
|
||||
if ($args->phone_country == '82')
|
||||
{
|
||||
if (Rhymix\Framework\Korea::isValidPhoneNumber($args->phone_number))
|
||||
{
|
||||
$args->phone_number = Rhymix\Framework\Korea::formatPhoneNumber($args->phone_number);
|
||||
}
|
||||
else
|
||||
if (!Rhymix\Framework\Korea::isValidPhoneNumber($args->phone_number))
|
||||
{
|
||||
return new BaseObject(-1, 'msg_invalid_phone_number');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue