fix(web): embed challenge ID into generated pages

Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
Xe Iaso
2025-08-02 20:10:57 +00:00
parent 5831002762
commit 02fc1079cc
9 changed files with 57 additions and 59 deletions

View File

@@ -92,15 +92,10 @@ func (s *Server) getTokenKeyfunc() jwt.Keyfunc {
}
func (s *Server) getChallenge(r *http.Request) (*challenge.Challenge, error) {
ckies := r.CookiesNamed(anubis.TestCookieName)
if len(ckies) == 0 {
return nil, store.ErrNotFound
}
id := r.FormValue("id")
j := store.JSON[challenge.Challenge]{Underlying: s.store}
ckie := ckies[0]
chall, err := j.Get(r.Context(), "challenge:"+ckie.Value)
chall, err := j.Get(r.Context(), "challenge:"+id)
return &chall, err
}