From e19104c86a527e51185f04cfda70cd41057eae1c Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Tue, 30 Apr 2024 14:59:58 -0400 Subject: [PATCH] Prevent initial out of date message on register --- db/account.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/db/account.go b/db/account.go index 7432e50..9bda722 100644 --- a/db/account.go +++ b/db/account.go @@ -41,6 +41,11 @@ func AddAccountSession(username string, token []byte) error { return err } + _, err = handle.Exec("UPDATE sessions s JOIN accounts a ON a.uuid = s.uuid SET s.active = 1 WHERE a.username = ? AND a.lastLoggedIn IS NULL", username) + if err != nil { + return err + } + _, err = handle.Exec("UPDATE accounts SET lastLoggedIn = UTC_TIMESTAMP() WHERE username = ?", username) if err != nil { return err