Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions sqlitestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func (m *SqliteStore) Delete(r *http.Request, w http.ResponseWriter, session *se
}

func (m *SqliteStore) save(session *sessions.Session) error {
if session.IsNew == true {
if session.IsNew {
return m.insert(session)
}
var createdOn time.Time
Expand Down Expand Up @@ -267,9 +267,9 @@ func (m *SqliteStore) load(session *sessions.Session) error {
if scanErr != nil {
return scanErr
}
if sess.expiresOn.Sub(time.Now()) < 0 {
if time.Until(sess.expiresOn) < 0 {
log.Printf("Session expired on %s, but it is %s now.", sess.expiresOn, time.Now())
return errors.New("Session expired")
return errors.New("session expired")
}
err := securecookie.DecodeMulti(session.Name(), sess.data, &session.Values, m.Codecs...)
if err != nil {
Expand All @@ -281,3 +281,11 @@ func (m *SqliteStore) load(session *sessions.Session) error {
return nil

}

func (m *SqliteStore) MaxLength(l int) {
for _, c := range m.Codecs {
if codec, ok := c.(*securecookie.SecureCookie); ok {
codec.MaxLength(l)
}
}
}