Bumped the cookie age to 30 days
This commit is contained in:
parent
b465899f85
commit
68a6169bc3
|
@ -8,6 +8,10 @@ import (
|
||||||
"lmika.dev/lmika/hugo-cms/services/users"
|
"lmika.dev/lmika/hugo-cms/services/users"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
authCookieAge = 30 * 24 * 3600 // 30 days
|
||||||
|
)
|
||||||
|
|
||||||
type AuthHandler struct {
|
type AuthHandler struct {
|
||||||
UserService *users.Service
|
UserService *users.Service
|
||||||
}
|
}
|
||||||
|
@ -37,8 +41,9 @@ func (h *AuthHandler) Login(c fiber.Ctx) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Cookie(&fiber.Cookie{
|
c.Cookie(&fiber.Cookie{
|
||||||
Name: models.AuthCookieName,
|
Name: models.AuthCookieName,
|
||||||
Value: string(bts),
|
Value: string(bts),
|
||||||
|
MaxAge: authCookieAge,
|
||||||
})
|
})
|
||||||
return c.Redirect().To("/")
|
return c.Redirect().To("/")
|
||||||
}
|
}
|
||||||
|
|
4
main.go
4
main.go
|
@ -115,7 +115,9 @@ func main() {
|
||||||
Views: tmplEngine,
|
Views: tmplEngine,
|
||||||
PassLocalsToViews: true,
|
PassLocalsToViews: true,
|
||||||
})
|
})
|
||||||
app.Use(encryptcookie.New(encryptcookie.Config{Key: cfg.EncryptedCookieKey}))
|
app.Use(encryptcookie.New(encryptcookie.Config{
|
||||||
|
Key: cfg.EncryptedCookieKey,
|
||||||
|
}))
|
||||||
|
|
||||||
app.Use("/assets", static.New("", static.Config{
|
app.Use("/assets", static.New("", static.Config{
|
||||||
FS: assets.FS,
|
FS: assets.FS,
|
||||||
|
|
Loading…
Reference in a new issue