diff --git a/application/common/library/Auth.php b/application/common/library/Auth.php index 5822241..4356bac 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 a2dd5ab..c9c7430 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' => '用户名不正确',