1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-21 11:57:02 +00:00

fix #1610 #1651 - read HISTORY.md

This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-10-04 16:50:21 +03:00
parent 5fc50a0049
commit cc7e3860f2
16 changed files with 484 additions and 874 deletions

View File

@@ -5,6 +5,7 @@ import (
"time"
"github.com/kataras/iris/v12/context"
"github.com/kataras/iris/v12/core/host"
)
func init() {
@@ -51,6 +52,9 @@ func New(cfg Config) *Sessions {
// a session db doesn't have write access
func (s *Sessions) UseDatabase(db Database) {
db.SetLogger(s.config.Logger) // inject the logger.
host.RegisterOnInterrupt(func() {
db.Close()
})
s.provider.RegisterDatabase(db)
}
@@ -125,8 +129,6 @@ func (s *Sessions) Start(ctx *context.Context, cookieOptions ...context.CookieOp
// fmt.Printf("%s=%s\n", key, value)
// })
// }
sess.isNew = s.provider.db.Len(sid) == 0
s.updateCookie(ctx, sid, s.config.Expires, cookieOptions...)
return sess