This commit is contained in:
Your Name 2024-10-08 18:58:57 -04:00
parent ffee6e1193
commit 575564031a
1 changed files with 5 additions and 5 deletions

10
main.go
View File

@ -47,7 +47,7 @@ func main() {
e.Type = "text" e.Type = "text"
e.Validator = "email" e.Validator = "email"
e.FailMessage = "Must be a valid email address" e.FailMessage = "Must be a valid email address"
e.Name = "email" e.Name = "theemail"
f.Add(e) f.Add(e)
e = forms.NewElement() e = forms.NewElement()
@ -56,7 +56,7 @@ func main() {
e.Validator = "" e.Validator = ""
e.Autocomplete = "new-password" e.Autocomplete = "new-password"
e.FailMessage = "Passsword Incorrect" e.FailMessage = "Passsword Incorrect"
e.Name = "oldpassword" e.Name = "theoldpassword"
f.Add(e) f.Add(e)
e = forms.NewElement() e = forms.NewElement()
@ -125,14 +125,14 @@ func main() {
defer c.Quit() defer c.Quit()
// Authenticate. // Authenticate.
if err := c.Auth(f.GetValue("email"), f.GetValue("oldpassword")); err != nil { if err := c.Auth(f.GetValue("theemail"), f.GetValue("theoldpassword")); err != nil {
f.MakeInvalid("oldpassword", "Invalid password") f.MakeInvalid("theoldpassword", "Invalid password")
d.Body = f.Render(true) d.Body = f.Render(true)
tmpl.Execute(w, d) tmpl.Execute(w, d)
return return
} }
// Change the password // Change the password
if !modifyPasswordFile(f.GetValue("email"), f.GetValue("newpassword")) { if !modifyPasswordFile(f.GetValue("theemail"), f.GetValue("newpassword")) {
log.Println(err) log.Println(err)
d.Body = "Internal error" d.Body = "Internal error"
tmpl.Execute(w, d) tmpl.Execute(w, d)