From 36d062d612d673622074e9316949b912115591ab Mon Sep 17 00:00:00 2001 From: F4NNIU Date: Fri, 15 May 2020 17:35:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E6=97=B6=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=E6=98=B5=E7=A7=B0=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/library/Auth.php | 6 +++++- application/index/lang/zh-cn/user.php | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/application/common/library/Auth.php b/application/common/library/Auth.php index 5822241e..4356bac2 100644 --- a/application/common/library/Auth.php +++ b/application/common/library/Auth.php @@ -125,11 +125,15 @@ class Auth */ public function register($username, $password, $email = '', $mobile = '', $extend = []) { - // 检测用户名或邮箱、手机号是否存在 + // 检测用户名、昵称、邮箱、手机号是否存在 if (User::getByUsername($username)) { $this->setError('Username already exist'); return false; } + if (User::getByNickname($username)) { + $this->setError('Nickname already exist'); + return false; + } if ($email && User::getByEmail($email)) { $this->setError('Email already exist'); return false; diff --git a/application/index/lang/zh-cn/user.php b/application/index/lang/zh-cn/user.php index a2dd5abc..c9c7430d 100755 --- a/application/index/lang/zh-cn/user.php +++ b/application/index/lang/zh-cn/user.php @@ -29,6 +29,7 @@ return [ 'Email is incorrect' => '邮箱格式不正确', 'Mobile is incorrect' => '手机格式不正确', 'Username already exist' => '用户名已经存在', + 'Nickname already exist' => '昵称已经存在', 'Email already exist' => '邮箱已经存在', 'Mobile already exist' => '手机号已经存在', 'Username is incorrect' => '用户名不正确',