Fixed Change Password Bug

This commit is contained in:
Chris Mann 2023-07-25 15:14:12 +02:00
parent 9a3f234f9b
commit 25035d684d
2 changed files with 9 additions and 6 deletions

View file

@ -19,9 +19,12 @@ func handleHome(w http.ResponseWriter, r *http.Request) {
login := checkLogin(w, r)
if login == nil {
handleLogin(w, r)
status := handleLogin(w, r)
if status == nil {
return
}
login = checkLogin(w, r)
}
data := HomePageData{
Login: login,

View file

@ -61,10 +61,7 @@ type LoginFormData struct {
func handleLogin(w http.ResponseWriter, r *http.Request) *LoginInfo {
templateLogin := getTemplate("login.html")
if r.Method == "GET" {
templateLogin.Execute(w, LoginFormData{CanAdmin: false})
return nil
} else if r.Method == "POST" {
if r.Method == "POST" {
// log.Printf("%v", "Parsing Form handleLogin")
r.ParseForm()
@ -100,6 +97,9 @@ func handleLogin(w http.ResponseWriter, r *http.Request) *LoginInfo {
}
return loginInfo
} else if r.Method == "GET" {
templateLogin.Execute(w, LoginFormData{CanAdmin: false})
return nil
} else {
http.Error(w, "Unsupported method", http.StatusBadRequest)
return nil