diff --git a/handlers/user.go b/handlers/user.go index 1cb3822..b55f036 100644 --- a/handlers/user.go +++ b/handlers/user.go @@ -48,6 +48,11 @@ func UserRegister(c *gin.Context) { } token1 = token } + err := tokens.CreateSessionFromToken(token1.Val, dbUser.ID) + if err != nil { + log.Printf("tokens.CreateSessionFromToken: %v\n", err) + c.JSON(500, types.ErrorResponse{Message: "ERROR: 1000"}) + } c.SetCookie(consts.COOKIE_SESSION, token1.Val, 3600, "/", "localhost", false, true) acc := types.Account{ ID: dbUser.ID, @@ -100,6 +105,11 @@ func UserLogin(c *gin.Context) { } token1 = token } + err := tokens.CreateSessionFromToken(token1.Val, foundUser.ID) + if err != nil { + log.Printf("tokens.CreateSessionFromToken: %v\n", err) + c.JSON(500, types.ErrorResponse{Message: "ERROR: 1000"}) + } c.SetCookie(consts.COOKIE_SESSION, token1.Val, 3600, "/", "localhost", false, true) acc := types.Account{ ID: foundUser.ID,