Compare commits

..

No commits in common. "e7f86d5de94439740244b387eed8a5978ab6f87c" and "69685440487b2d2e4d836079af44d0fb52dba3ee" have entirely different histories.

1 changed files with 5 additions and 6 deletions

View File

@ -51,7 +51,7 @@ func (h *Handler) Handler() http.Handler {
Skipper: func(w http.ResponseWriter, r *http.Request) bool {
head, _ := urlutil.ShiftPath(r.URL.Path)
return head == ""
return r.Method == http.MethodPost && head == ""
},
CookieMaxAge: 0,
CookieSameSite: http.SameSiteStrictMode,
@ -68,11 +68,9 @@ func (h *Handler) Handler() http.Handler {
Skipper: func(w http.ResponseWriter, r *http.Request) bool {
head, _ := urlutil.ShiftPath(r.URL.Path)
return r.Method != http.MethodPost ||
head != "verify" ||
r.PostFormValue("authorize") == "deny"
return r.Method != http.MethodPost || head != "verify"
},
Validator: func(_ http.ResponseWriter, _ *http.Request, login, password string) (bool, error) {
Validator: func(w http.ResponseWriter, r *http.Request, login, password string) (bool, error) {
userMatch := subtle.ConstantTimeCompare([]byte(login),
[]byte(h.config.IndieAuth.Username))
passMatch := subtle.ConstantTimeCompare([]byte(password),
@ -85,7 +83,8 @@ func (h *Handler) Handler() http.Handler {
}
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
head, _ := urlutil.ShiftPath(r.URL.Path)
var head string
head, r.URL.Path = urlutil.ShiftPath(r.URL.Path)
switch r.Method {
default: