From c17c583321f6b4fd86ac6f1212102484559793ec Mon Sep 17 00:00:00 2001 From: Up Date: Wed, 15 May 2024 06:46:08 +0200 Subject: [PATCH] update active session if none is found --- db/account.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/db/account.go b/db/account.go index a54b7bc..47f24c2 100644 --- a/db/account.go +++ b/db/account.go @@ -215,17 +215,14 @@ func IsActiveSession(uuid []byte, clientSessionId string) (bool, error) { err := handle.QueryRow("SELECT clientSessionId FROM activeClientSessions WHERE uuid = ?", uuid).Scan(&storedId) if err != nil { if errors.Is(err, sql.ErrNoRows) { - return false, nil + err = UpdateActiveSession(uuid, clientSessionId) + if err != nil { + return false, err + } + return true, nil } return false, err } - if storedId == "" { - err = UpdateActiveSession(uuid, clientSessionId) - if err != nil { - return false, err - } - return true, nil - } return storedId == clientSessionId, nil }