🐛修复新增管理员时密码未hash

This commit is contained in:
coward
2024-03-14 15:33:54 +08:00
parent 8dfef5192e
commit 763443bad2
5 changed files with 45 additions and 13 deletions

View File

@@ -78,6 +78,8 @@ func (r user) Save(ent *entity.User) (err error) {
defaultPassword := utils.Password().GenerateHashPassword("admin123")
if ent.Password == "" { // 没有密码给一个默认密码
ent.Password = defaultPassword
} else {
ent.Password = utils.Password().GenerateHashPassword(ent.Password)
}
// 没有头像就生成一个头像