mirror of https://gitee.com/karson/fastadmin.git
commit
cf4949db77
|
|
@ -125,11 +125,15 @@ class Auth
|
||||||
*/
|
*/
|
||||||
public function register($username, $password, $email = '', $mobile = '', $extend = [])
|
public function register($username, $password, $email = '', $mobile = '', $extend = [])
|
||||||
{
|
{
|
||||||
// 检测用户名或邮箱、手机号是否存在
|
// 检测用户名、昵称、邮箱、手机号是否存在
|
||||||
if (User::getByUsername($username)) {
|
if (User::getByUsername($username)) {
|
||||||
$this->setError('Username already exist');
|
$this->setError('Username already exist');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (User::getByNickname($username)) {
|
||||||
|
$this->setError('Nickname already exist');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if ($email && User::getByEmail($email)) {
|
if ($email && User::getByEmail($email)) {
|
||||||
$this->setError('Email already exist');
|
$this->setError('Email already exist');
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ return [
|
||||||
'Email is incorrect' => '邮箱格式不正确',
|
'Email is incorrect' => '邮箱格式不正确',
|
||||||
'Mobile is incorrect' => '手机格式不正确',
|
'Mobile is incorrect' => '手机格式不正确',
|
||||||
'Username already exist' => '用户名已经存在',
|
'Username already exist' => '用户名已经存在',
|
||||||
|
'Nickname already exist' => '昵称已经存在',
|
||||||
'Email already exist' => '邮箱已经存在',
|
'Email already exist' => '邮箱已经存在',
|
||||||
'Mobile already exist' => '手机号已经存在',
|
'Mobile already exist' => '手机号已经存在',
|
||||||
'Username is incorrect' => '用户名不正确',
|
'Username is incorrect' => '用户名不正确',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue