mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2025-10-29 09:15:33 +00:00
SECURITY: store hashed session tokens
This commit is contained in:
@@ -32,7 +32,8 @@ func Authenticated(app core.App) func(*core.RequestEvent) error {
|
||||
|
||||
user, session, loaded := SESSION_CACHE.Get(cookie.Value)
|
||||
if !loaded {
|
||||
record, err := app.FindFirstRecordByData(dbmodels.SESSIONS_TABLE, dbmodels.SESSIONS_TOKEN_FIELD, cookie.Value)
|
||||
hashedsession := dbmodels.HashStringSHA256(cookie.Value)
|
||||
record, err := app.FindFirstRecordByData(dbmodels.SESSIONS_TABLE, dbmodels.SESSIONS_TOKEN_FIELD, hashedsession)
|
||||
if err != nil {
|
||||
e.SetCookie(deact_cookie)
|
||||
e.Response.Header().Set("Clear-Site-Data", "\"cookies\"")
|
||||
|
||||
Reference in New Issue
Block a user