注册时防止昵称重复

pull/196/head
F4NNIU 2020-05-15 17:35:51 +08:00
parent 8c99271e66
commit 36d062d612
2 changed files with 6 additions and 1 deletions

View File

@ -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;

View File

@ -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' => '用户名不正确',