This commit is contained in:
@@ -79,6 +79,16 @@ func RegisterUser(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if len(input.UserName) == 0 {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "no username specified"})
|
||||
return
|
||||
}
|
||||
|
||||
if len(input.Password) == 0 {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "no password specified"})
|
||||
return
|
||||
}
|
||||
|
||||
u := models.User{}
|
||||
//u.RoleId = 1
|
||||
u.UserName = input.UserName
|
||||
@@ -86,7 +96,7 @@ func RegisterUser(c *gin.Context) {
|
||||
|
||||
// Default to regular user role if not specified
|
||||
if input.RoleId == 0 {
|
||||
log.Printf("Register no role specified, defaulting to RoleId of 2.\n")
|
||||
log.Printf("Register no role specified, defaulting to builtin role UserRole with id 2.\n")
|
||||
u.RoleId = 2
|
||||
} else {
|
||||
u.RoleId = input.RoleId
|
||||
|
Reference in New Issue
Block a user