Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
cookieY committed Jan 3, 2020
1 parent ad4e3a1 commit 4e463bb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/handle/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ func UserRegister(c echo.Context) (err error) {
}
var unique model.CoreAccount
g, _ := json.Marshal(model.InitPer)
ix, _ := json.Marshal([]string{})
model.DB().Where("username = ?", u.UserInfo["username"]).Select("username").First(&unique)
if unique.Username != "" {
return c.JSON(http.StatusOK, "用户已存在请重新注册!")
Expand All @@ -152,7 +153,7 @@ func UserRegister(c echo.Context) (err error) {
Department: u.UserInfo["department"],
Email: u.UserInfo["email"],
})
model.DB().Create(&model.CoreGrained{Username: u.UserInfo["username"], Permissions: g, Rule: "guest"})
model.DB().Create(&model.CoreGrained{Username: u.UserInfo["username"], Permissions: g, Rule: "guest", Group: ix})
return c.JSON(http.StatusOK, "注册成功!")
}
return c.JSON(http.StatusForbidden, "没有开启注册通道!")
Expand Down

0 comments on commit 4e463bb

Please sign in to comment.