Fixed Change Password Bug
This commit is contained in:
parent
9a3f234f9b
commit
25035d684d
2 changed files with 9 additions and 6 deletions
5
home.go
5
home.go
|
@ -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,
|
||||
|
|
8
login.go
8
login.go
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue