Compare commits

..

No commits in common. "e6bf0da7c621277eafe3638d6adfc244fb729724" and "1caf06934fdc60ce35be4d9876ead98457dbdc0e" have entirely different histories.

6 changed files with 10 additions and 15 deletions

View File

@ -3,13 +3,13 @@ module lishwist/http
go 1.25.5
require (
github.com/Teajey/rsvp v0.21.1
github.com/Teajey/rsvp v0.19.0-rc.2
github.com/gorilla/sessions v1.4.0
golang.org/x/crypto v0.39.0
)
require (
github.com/Teajey/hmc v0.9.0
github.com/Teajey/hmc v0.6.0-rc.12
github.com/gorilla/securecookie v1.1.2
)

View File

@ -1,11 +1,7 @@
github.com/Teajey/hmc v0.6.0-rc.12 h1:Vkx6mJa3pfMlYx4vyI9LfVLHa8fNyl8LikMvXBfDGZk=
github.com/Teajey/hmc v0.6.0-rc.12/go.mod h1:9K7SL4RyybNLHooqsZcyFoL6QGqqa2zPgIBidw4qWQY=
github.com/Teajey/hmc v0.9.0 h1:OYDn95/ZheJlVQTXFIztsuU2jUG57XahcMpJZ5dM1VQ=
github.com/Teajey/hmc v0.9.0/go.mod h1:9K7SL4RyybNLHooqsZcyFoL6QGqqa2zPgIBidw4qWQY=
github.com/Teajey/rsvp v0.19.0-rc.2 h1:h4V7c3uGlSKajkWKt3fldFV+XTMEI8A4o05PMY8xv9A=
github.com/Teajey/rsvp v0.19.0-rc.2/go.mod h1:z0L20VphVg+Ec2+hnpLFTG2MZTrWYFprav1kpxDba0Q=
github.com/Teajey/rsvp v0.21.1 h1:qDo0VHvatOKFG6oqsq3daPOq0TU9pjicdz5mwxwGMO4=
github.com/Teajey/rsvp v0.21.1/go.mod h1:z0L20VphVg+Ec2+hnpLFTG2MZTrWYFprav1kpxDba0Q=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=

View File

@ -85,9 +85,9 @@ func (m *Private) handleWithSession(pattern string, next handler.PublicFunc) {
r: r,
}
err := rsvp.Write(rw, r, m.rsvp, rsvp.HandlerFunc(func(w rsvp.ResponseWriter, r *http.Request) rsvp.Body {
err := rsvp.Write(rw, m.rsvp, r, func(w rsvp.ResponseWriter, r *http.Request) rsvp.Body {
return next(s, w, r)
}))
})
if err != nil {
log.Printf("rsvp failed to write a response: %s", err)
}

View File

@ -178,19 +178,19 @@ func InitialTodo(todo []lishwist.Wish) Wishlist {
func (w Wishlist) ExtractFormValues(form url.Values) {
if w.NewWish != nil {
_ = w.NewWish.Elements.ExtractValue(form)
w.NewWish.Elements.ExtractFormValue(form)
}
if w.Wishes == nil {
return
}
err := w.Wishes.Elements.Select.ExtractValue(form)
err := w.Wishes.Elements.Select.ExtractFormValue(form)
if err != nil {
w.Wishes.Elements.Select.Error = err.Error()
}
err = w.Wishes.Elements.Intent.ExtractValue(form)
err = w.Wishes.Elements.Intent.ExtractFormValue(form)
if err != nil {
w.Wishes.Elements.Intent.Error = err.Error()
}

View File

@ -1,7 +1,6 @@
package routing
import (
"cmp"
"errors"
"log"
"net/http"
@ -104,10 +103,10 @@ func LoginPost(session *session.Session, w rsvp.ResponseWriter, r *http.Request)
login := LoginMiddle(username, password, session, r)
if login != nil {
page.Form.Elements = *login
return rsvp.Data(page).StatusSeeOther(".")
return rsvp.Data(page).StatusSeeOther("")
}
referrer := r.URL.Query().Get("referrer")
return rsvp.Data("Login successful!").StatusSeeOther(cmp.Or(referrer, "."))
return rsvp.Data("Login successful!").StatusSeeOther(referrer)
}

View File

@ -1,6 +1,6 @@
{{define "input"}}
<input style="padding: .375rem .75rem;" class="form-control{{if .Error}} is-invalid{{end}}" {{if .Type}}type="{{.Type}}" {{end}}name="{{.Name}}"
value="{{.Value}}" {{if .Required}}required {{end}}{{if .MinLength}}minlength="{{.MinLength}}" {{end}}{{with .Error}} aria-describedby="{{$.Name}}Error"{{end}}>
value="{{.Value}}" {{if .Required}}required {{end}}{{if .MinLength}}minlength="{{.MinLength}}" {{end}}{{with .Error}} aria-describedby="{{.Name}}Error"{{end}}>
{{with .Error}}
<div id="{{$.Name}}Error" class="invalid-feedback">
{{.}}