This commit is contained in:
parent
a12552a608
commit
72420f2ede
@ -39,6 +39,11 @@ func (s user) CreateUser(user *model.User) (err error) {
|
||||
return s.Model(&model.User{}).Where("id = ?", user.Id).Updates(&updates).Error
|
||||
}
|
||||
|
||||
// 判断账号是否已经存在
|
||||
if _, err = s.GetUserByAccount(user.Account); err == nil {
|
||||
return errors.New("账号已经存在,请勿重复创建!")
|
||||
}
|
||||
|
||||
defaultPassword := utils.Password().GenerateHashPassword("admin123")
|
||||
if user.Password == "" { // 没有密码给一个默认密码
|
||||
user.Password = defaultPassword
|
||||
|
Loading…
Reference in New Issue
Block a user