go: redirect signed users from / to /home
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
leo 2023-05-06 00:09:13 +02:00
parent eafc9c1e92
commit c4f8cf87f5
Signed by: wanderer
SSH Key Fingerprint: SHA256:Dp8+iwKHSlrMEHzE3bJnPng70I7LEsa3IJXRH/U+idQ

@ -119,6 +119,13 @@ func Admin() echo.HandlerFunc {
func Index() echo.HandlerFunc { func Index() echo.HandlerFunc {
return func(c echo.Context) error { return func(c echo.Context) error {
sess, _ := session.Get(setting.SessionCookieName(), c)
username := sess.Values["username"]
if username != nil {
return c.Redirect(http.StatusFound, "/home")
}
tpl := getTmpl("index.tmpl") tpl := getTmpl("index.tmpl")
csrf := c.Get("csrf").(string) csrf := c.Get("csrf").(string)