mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-11-04 16:40:21 +00:00
fix: create user form
This commit is contained in:
1 parent
75101d860f
commit
1a21abddcf
2 files changed
+5
-1
No files matched your search
@@ -112,10 +112,13 @@ func createUser(c *gin.Context) (uint64, error) {
|
||||
if uf.Username == "" {
|
||||
return 0, singleton.Localizer.ErrorT("username can't be empty")
|
||||
}
|
||||
if uf.Role != model.RoleAdmin && uf.Role != model.RoleMember {
|
||||
return 0, singleton.Localizer.ErrorT("invalid role")
|
||||
}
|
||||
|
||||
var u model.User
|
||||
u.Username = uf.Username
|
||||
u.Role = model.RoleMember
|
||||
u.Role = uf.Role
|
||||
|
||||
hash, err := bcrypt.GenerateFromPassword([]byte(uf.Password), bcrypt.DefaultCost)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user