package webserver import ( "net/http" "strings" "text/template" ) type LoginPageData struct { IsHiddenClassList string } func loginHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html; charset=utf-8") tmpl := template.Must(template.ParseFiles("webserver/pages/login_page.html")) if r.Method == http.MethodGet { tmpl.Execute(w, LoginPageData{IsHiddenClassList: "hidden"}) return } if r.Method == http.MethodPost { username := r.FormValue("username") if strings.Contains(username, "/") { tmpl.Execute(w, LoginPageData{IsHiddenClassList: ""}) } } }