Fixed Change Password Bug
This commit is contained in:
parent
9a3f234f9b
commit
25035d684d
2 changed files with 9 additions and 6 deletions
7
home.go
7
home.go
|
@ -19,8 +19,11 @@ func handleHome(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
login := checkLogin(w, r)
|
login := checkLogin(w, r)
|
||||||
if login == nil {
|
if login == nil {
|
||||||
handleLogin(w, r)
|
status := handleLogin(w, r)
|
||||||
return
|
if status == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
login = checkLogin(w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
data := HomePageData{
|
data := HomePageData{
|
||||||
|
|
8
login.go
8
login.go
|
@ -61,10 +61,7 @@ type LoginFormData struct {
|
||||||
func handleLogin(w http.ResponseWriter, r *http.Request) *LoginInfo {
|
func handleLogin(w http.ResponseWriter, r *http.Request) *LoginInfo {
|
||||||
templateLogin := getTemplate("login.html")
|
templateLogin := getTemplate("login.html")
|
||||||
|
|
||||||
if r.Method == "GET" {
|
if r.Method == "POST" {
|
||||||
templateLogin.Execute(w, LoginFormData{CanAdmin: false})
|
|
||||||
return nil
|
|
||||||
} else if r.Method == "POST" {
|
|
||||||
// log.Printf("%v", "Parsing Form handleLogin")
|
// log.Printf("%v", "Parsing Form handleLogin")
|
||||||
r.ParseForm()
|
r.ParseForm()
|
||||||
|
|
||||||
|
@ -100,6 +97,9 @@ func handleLogin(w http.ResponseWriter, r *http.Request) *LoginInfo {
|
||||||
}
|
}
|
||||||
return loginInfo
|
return loginInfo
|
||||||
|
|
||||||
|
} else if r.Method == "GET" {
|
||||||
|
templateLogin.Execute(w, LoginFormData{CanAdmin: false})
|
||||||
|
return nil
|
||||||
} else {
|
} else {
|
||||||
http.Error(w, "Unsupported method", http.StatusBadRequest)
|
http.Error(w, "Unsupported method", http.StatusBadRequest)
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue