1
0
mirror of https://github.com/volatiletech/authboss.git synced 2024-11-28 08:58:38 +02:00

Fix bug in remember

This commit is contained in:
Aaron L 2019-01-12 11:30:39 -08:00
parent 6402c5da57
commit 470b7c0488
2 changed files with 7 additions and 2 deletions

View File

@ -49,6 +49,12 @@ func (u UserValues) GetValues() map[string]string {
return u.Arbitrary
}
// GetShouldRemember checks the form values for
func (u UserValues) GetShouldRemember() bool {
rm, ok := u.Values[authboss.CookieRemember]
return ok && rm == "true"
}
// ConfirmValues retrieves values on the confirm page.
type ConfirmValues struct {
HTTPFormValidator

View File

@ -11,7 +11,6 @@ import (
"net/http"
"github.com/pkg/errors"
"github.com/volatiletech/authboss"
)
@ -44,7 +43,7 @@ func (r *Remember) RememberAfterAuth(w http.ResponseWriter, req *http.Request, h
rmIntf := req.Context().Value(authboss.CTXKeyValues)
if rmIntf == nil {
return false, nil
} else if rm, ok := rmIntf.(authboss.RememberValuer); ok && !rm.GetShouldRemember() {
} else if rm, ok := rmIntf.(authboss.RememberValuer); !ok || !rm.GetShouldRemember() {
return false, nil
}