admin: Improve user and provider creation
This commit is contained in:
parent
11b0a4d439
commit
3a05d4accb
@ -126,9 +126,8 @@ func newUserProvider(c *gin.Context) {
|
||||
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"errmsg": fmt.Sprintf("Something is wrong in received data: %s", err.Error())})
|
||||
return
|
||||
}
|
||||
us.Id = nil
|
||||
|
||||
src, err := storage.MainStore.CreateProvider(user.(*happydns.User), us, "")
|
||||
src, err := storage.MainStore.CreateProvider(user.(*happydns.User), us.Provider, us.Comment)
|
||||
ApiResponse(c, src, err)
|
||||
}
|
||||
|
||||
|
@ -78,9 +78,12 @@ func newUser(c *gin.Context) {
|
||||
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"errmsg": fmt.Sprintf("Something is wrong in received data: %s", err.Error())})
|
||||
return
|
||||
}
|
||||
uu.Id = []byte{}
|
||||
|
||||
if uu.Id.IsEmpty() {
|
||||
ApiResponse(c, uu, storage.MainStore.CreateUser(uu))
|
||||
} else {
|
||||
ApiResponse(c, uu, storage.MainStore.UpdateUser(uu))
|
||||
}
|
||||
}
|
||||
|
||||
func deleteUsers(c *gin.Context) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user