支持系统手机号登录系统

2024-06-05 11:22 更新

介绍

扩展现有Dzz登录功能,以便支持使用系统手机号进行登录。

实现方法

文件:core/function/function_core.php在

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); }

文件:user/function/function_user.php在

elseif ($isuid == 2) { $user = C::t('user')->fetch_by_email($username); }

后添加

elseif ($isuid == 3) {//手机号码登录 $user = C::t('user')->fetch_by_phone($username); }

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); }

文件:user/language/zh-cn/lang.php将

'email_username' => '邮箱或用户名',

修改为

'email_username' => '邮箱、用户名或手机号',

注意

系统手机号需由管理员在机构用户中进行设置,不是用户个人资料中的手机号。



以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号