diff --git a/src/basolato/core/security/session_db/redis_session_db.nim b/src/basolato/core/security/session_db/redis_session_db.nim index 6187cce3..afd3f944 100644 --- a/src/basolato/core/security/session_db/redis_session_db.nim +++ b/src/basolato/core/security/session_db/redis_session_db.nim @@ -87,12 +87,13 @@ proc new*(_:type RedisSessionDb, sessionId=""):Future[RedisSessionDb] {.async.} sessionId let conn = openAsync(REDIS_IP, Port(REDIS_PORT)).await - discard conn.expire(id, SESSION_TIME * 60).await let sessionDb = RedisSessionDb( conn: conn, id:id, ) + sessionDb.setStr("session_id", id).await + discard sessionDb.conn.expire(id, SESSION_TIME * 60).await return sessionDb diff --git a/tests/auth/test_redis_session_db.nim b/tests/auth/test_redis_session_db.nim index d3b2ffaa..4b4e68d5 100644 --- a/tests/auth/test_redis_session_db.nim +++ b/tests/auth/test_redis_session_db.nim @@ -19,12 +19,12 @@ suite("redis session db"): test("new with empty should regenerate id"): let session = RedisSessionDb.new("").waitFor().toInterface() - token = session.getToken().waitFor() + let token = session.getToken().waitFor() check token.len == 256 test("new with invalid id should regenerate id"): let session = RedisSessionDb.new("invalid").waitFor().toInterface() - token = session.getToken().waitFor() + let token = session.getToken().waitFor() check token.len == 256 test("setStr / getStr"): @@ -32,7 +32,6 @@ suite("redis session db"): session.setStr("str", "value").waitFor() check session.getStr("str").waitFor() == "value" - test("setJson / getJson"): let session = RedisSessionDb.new(token).waitFor().toInterface() session.setJson("json", %*{"key": "value"}).waitFor()