diff --git a/main.go b/main.go index 2f9c6cd..0bdd5bd 100644 --- a/main.go +++ b/main.go @@ -9,18 +9,8 @@ import ( ) func opisStołówkaZPM(w http.ResponseWriter, r *http.Request) { - t, _ := template.ParseFiles("StronaGlowna.tmpl") + t, _ := template.ParseFiles("StronaGlowna.gtpl") t.Execute(w, nil) - //r.ParseForm() - //fmt.Println(r.Form) - //fmt.Println("path", r.URL.Path) - //fmt.Println("scheme", r.URL.Scheme) - //fmt.Println(r.Form["url_long"]) - //for k, v := range r.Form { - // fmt.Println("key:", k) - // fmt.Println("val:", strings.Join(v, "")) - //} - } func panel(w http.ResponseWriter, r *http.Request) { @@ -30,19 +20,19 @@ func panel(w http.ResponseWriter, r *http.Request) { } func login(w http.ResponseWriter, r *http.Request) { +Here: fmt.Println("method:", r.Method) if r.Method == "GET" { - t, _ := template.ParseFiles("login.html") + t, _ := template.ParseFiles("login.gtpl") t.Execute(w, nil) } else { r.ParseForm() fmt.Println("username:", r.Form["username"]) fmt.Println("password:", r.Form["password"]) + if len(r.Form["username"][0]) == 0 { + goto Here + } } - //if r.Method == "POST" { - // t, _ := template.ParseFiles("panel.gtpl") - // t.Execute(w, nil) - //} username := r.Form["username"] password := r.Form["password"] zaloguj := "Wpisane wartości:"