Fixed logout
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2019-09-03 20:28:52 +02:00
parent 0ff4e3ed8d
commit d49247ac6f
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 5 additions and 1 deletions

View File

@ -3,17 +3,21 @@ package router
import (
"net/http"
"github.com/gorilla/sessions"
"github.com/labstack/echo-contrib/session"
"github.com/labstack/echo/v4"
)
func logout(c echo.Context) error {
sess, _ := session.Get(sessionName, c)
sess.Options = &sessions.Options{
MaxAge: 86400 * -7,
}
sess.Values[sessionKey] = false
err := sess.Save(c.Request(), c.Response())
if err != nil {
return echo.ErrInternalServerError
}
return c.Redirect(http.StatusSeeOther, "/admin")
return c.Redirect(http.StatusFound, "/admin")
}