fix(lib): make ClearCookie respect the dynamic cookie name (#500)
Previously this made ClearCookie always clear cookies by name even when CookieDomain was set. This change fixes this and adds tests to make sure that this doesn't happen again. Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
parent
5e1abdd31c
commit
6a12efee08
3 changed files with 60 additions and 3 deletions
|
|
@ -9,13 +9,11 @@ import (
|
|||
"github.com/TecharoHQ/anubis/lib/policy"
|
||||
"github.com/TecharoHQ/anubis/web"
|
||||
"github.com/a-h/templ"
|
||||
|
||||
"github.com/TecharoHQ/anubis"
|
||||
)
|
||||
|
||||
func (s *Server) ClearCookie(w http.ResponseWriter) {
|
||||
http.SetCookie(w, &http.Cookie{
|
||||
Name: anubis.CookieName,
|
||||
Name: s.cookieName,
|
||||
Value: "",
|
||||
Expires: time.Now().Add(-1 * time.Hour),
|
||||
MaxAge: -1,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue