go(logout): redir to /home if valid session exists
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
9dd5f05eb6
commit
c8a48cd526
@ -36,6 +36,13 @@ func Logout() echo.HandlerFunc {
|
|||||||
return c.Redirect(http.StatusMovedPermanently, "/logout")
|
return c.Redirect(http.StatusMovedPermanently, "/logout")
|
||||||
|
|
||||||
case c.Request().Method == "GET":
|
case c.Request().Method == "GET":
|
||||||
|
sess, _ := session.Get(setting.SessionCookieName(), c)
|
||||||
|
if sess != nil {
|
||||||
|
if username := sess.Values["username"]; username != nil {
|
||||||
|
return c.Redirect(http.StatusSeeOther, "/home")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err := c.Render(
|
err := c.Render(
|
||||||
http.StatusOK,
|
http.StatusOK,
|
||||||
"logout.tmpl",
|
"logout.tmpl",
|
||||||
|
Loading…
Reference in New Issue
Block a user