This commit is contained in:
2024-07-10 12:14:25 +07:00
parent 465e77832e
commit 75abc7e651
5 changed files with 16 additions and 2 deletions
+12 -1
View File
@@ -99,7 +99,6 @@ func PostUserRegister(c *gin.Context) {
user.Username = username
user.Password = encryption.GetMD5ByStr(pwd)
user.Role = role
// user.Role = "user"
user = service.MyService.User().CreateUser(user)
if user.Id == 0 {
c.JSON(common_err.SERVICE_ERROR, model.Result{Success: common_err.SERVICE_ERROR, Message: common_err.GetMsg(common_err.SERVICE_ERROR)})
@@ -263,6 +262,18 @@ func PostOMVLogin(c *gin.Context) {
})
}
func PostLogout(c *gin.Context) {
cookies := c.Request.Cookies()
for _, cookie := range cookies {
// Set the cookie to expire immediately
c.SetCookie(cookie.Name, "", -1, "/", "", false, true)
}
c.JSON(common_err.SUCCESS,
model.Result{
Success: common_err.SUCCESS,
Message: common_err.GetMsg(common_err.SUCCESS),
})
}
func isEmpty(obj interface{}) bool {
jsonData, err := json.Marshal(obj)