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