package app import ( "net/http" ) func (a *App) redirectRoot(rw http.ResponseWriter, req *http.Request) { if req.URL.Path != "/" { http.NotFound(rw, req) return } if a.setupRequired() { http.Redirect(rw, req, "/map/setup", http.StatusFound) return } http.Redirect(rw, req, "/map/profile", http.StatusFound) } func (a *App) redirectLogin(rw http.ResponseWriter, req *http.Request) { if req.URL.Path != "/login" { http.NotFound(rw, req) return } http.Redirect(rw, req, "/map/login", http.StatusFound) } func (a *App) redirectLogout(rw http.ResponseWriter, req *http.Request) { if req.URL.Path != "/logout" { http.NotFound(rw, req) return } s := a.getSession(req) if s != nil { a.deleteSession(s) } http.Redirect(rw, req, "/map/login", http.StatusFound) } func (a *App) redirectAdmin(rw http.ResponseWriter, req *http.Request) { http.Redirect(rw, req, "/map/admin", http.StatusFound) }