Fix cookie weirdness (delete correctly using MaxAge)
This commit is contained in:
parent
18e07e322f
commit
9b3743e79a
2 changed files with 7 additions and 4 deletions
|
@ -156,6 +156,7 @@ func (a *Auth) routeRefresh(w http.ResponseWriter, r *http.Request) {
|
|||
cookie := &http.Cookie{
|
||||
Name: "jwt",
|
||||
Value: tok,
|
||||
Path: "/",
|
||||
HttpOnly: true,
|
||||
Secure: true,
|
||||
}
|
||||
|
@ -216,6 +217,7 @@ func (a *Auth) routeAuth(w http.ResponseWriter, r *http.Request) {
|
|||
cookie := &http.Cookie{
|
||||
Name: "jwt",
|
||||
Value: tok,
|
||||
Path: "/",
|
||||
HttpOnly: true,
|
||||
Secure: true,
|
||||
}
|
||||
|
@ -242,9 +244,10 @@ func (a *Auth) routeLogout(w http.ResponseWriter, r *http.Request) {
|
|||
cookie := &http.Cookie{
|
||||
Name: "jwt",
|
||||
Value: "",
|
||||
Path: "/",
|
||||
HttpOnly: true,
|
||||
Secure: true,
|
||||
Expires: time.Time{},
|
||||
MaxAge: -1,
|
||||
}
|
||||
|
||||
if a.allowInsecureCookie(r) {
|
||||
|
|
|
@ -43,7 +43,7 @@ var ErrBadTG = errors.New("bad talkgroup format")
|
|||
func (tid *ID) UnmarshalJSON(j []byte) error {
|
||||
// this is a dirty hack since we cannot implement both TextUnmarshaler
|
||||
// and json.Unmarshaler at the same time. sigh.
|
||||
v := &struct{
|
||||
v := &struct {
|
||||
System uint32 `json:"sys"`
|
||||
Talkgroup uint32 `json:"tg"`
|
||||
}{}
|
||||
|
|
Loading…
Reference in a new issue