If already logged in, redirect to main page

This commit is contained in:
Radhi Fadlillah 2018-02-24 14:02:06 +07:00
parent 07f0d333ec
commit b0796d3ed3

View file

@ -120,6 +120,13 @@ func serveIndexPage(w http.ResponseWriter, r *http.Request, ps httprouter.Params
}
func serveLoginPage(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
// Check token
err := checkToken(r)
if err == nil {
redirectPage(w, r, "/")
return
}
asset, _ := assets.ReadFile("login.html")
w.Header().Set("Content-Type", "text/html")
buffer := bytes.NewBuffer(asset)