Пример #1
0
func Logout(c *gin.Context) {
	session := sessions.Default(c)
	session.Delete("internal")
	session.Delete(gin.AuthUserKey)
	SessionSave(c)
	c.Redirect(http.StatusTemporaryRedirect, "/")
}
Пример #2
0
func SessionSave(c *gin.Context) {
	session := sessions.Default(c)
	session.Delete("internal")
	session.Save()
}
Пример #3
0
func GetSession(c *gin.Context) sessions.Session {
	session := sessions.Default(c)
	return session
}
Пример #4
0
func SessionGet(c *gin.Context, key interface{}) interface{} {
	session := sessions.Default(c)
	return session.Get(key)
}
Пример #5
0
func SessionSet(c *gin.Context, key interface{}, value interface{}) {
	session := sessions.Default(c)
	session.Set(key, value)
}