DEVELOPMENT ENVIRONMENT

~liljamo/tixe

fd89e5586bdbdf5e55057348c82306f33718cdb8 — Jonni Liljamo 1 year, 1 month ago 587179c
fix: fix cookie issue
1 files changed, 3 insertions(+), 2 deletions(-)

M middlewares/auth.go
M middlewares/auth.go => middlewares/auth.go +3 -2
@@ 33,8 33,6 @@ func IsAuthenticated(c *gin.Context) {
			"SELECT EXISTS(SELECT 1 FROM users WHERE id = $1)",
				user.Id).Scan(&exists)
		if err != nil || !exists {
			c.Redirect(http.StatusSeeOther, "/login")
			c.Abort()
			session.Clear()
			if err := session.Save(); err != nil {
				errStr := "Failed to save session"


@@ 42,6 40,9 @@ func IsAuthenticated(c *gin.Context) {
				util.RenderError(c, "session error", errStr, nil)
				return
			}
			c.Redirect(http.StatusSeeOther, "/login")
			c.Abort()
			return
		}

		c.Next()