支持系统手机号登录系统

Signed-off-by: 小胡 <3203164629@qq.com>
This commit is contained in:
小胡
2024-03-04 09:37:27 +00:00
committed by Gitee
Unverified
parent 4772264632
commit dfa31fd1a1
3 changed files with 11 additions and 2 deletions

View File

@@ -628,6 +628,11 @@ function isemail($email)
return strlen($email) > 6 && strlen($email) <= 32 && preg_match("/^([A-Za-z0-9\-_.+]+)@([A-Za-z0-9\-]+[.][A-Za-z0-9\-.]+)$/", $email);
}
function isphone($phone)
{
return preg_match("/^1[3456789]\d{9,10}$/", $phone);
}
function quescrypt($questionid, $answer)
{
return $questionid > 0 && $answer != '' ? substr(md5($answer . md5($questionid)), 16, 8) : '';

View File

@@ -23,7 +23,9 @@ function uc_user_login($username, $password, $isuid, $checkques = '', $questioni
} elseif ($isuid == 2) {
$user = C::t('user')->fetch_by_email($username);
} else {
} elseif ($isuid == 3) {//手机号码登录
$user = C::t('user')->fetch_by_phone($username);
}else {
$user = C::t('user')->fetch_by_username($username);
}
@@ -61,6 +63,8 @@ function userlogin($username, $password, $questionid = '', $answer = '', $loginf
$return['ucresult'] = uc_user_login($username, $password, 1, 1, $questionid, $answer, $ip);
} elseif (isemail($username)) {
$return['ucresult'] = uc_user_login($username, $password, 2, 1, $questionid, $answer, $ip);
} elseif (isphone($username)) {
$return['ucresult'] = uc_user_login($username, $password, 3, 1, $questionid, $answer, $ip);
}
if ($return['ucresult'][0] <= 0 && $return['ucresult'][0] != -3) {
$return['ucresult'] = uc_user_login(addslashes($username), $password, 0, 1, $questionid, $answer, $ip);

View File

@@ -98,7 +98,7 @@ $lang=array (
'other_login' => '其他登录',
'qq_login' => 'QQ登录',
'automatic_login_within_thirtydays' => '30天内自动登录',
'email_username' => '邮箱用户名',
'email_username' => '邮箱用户名或手机号',
'binding_for_account' => '绑定已有账号',
'register_new_account_bound' => '注册新账号并绑定',
'register_new_account' => '注册新账号',