Fix query in GetUsernameFromToken

pull/1/head
maru 12 months ago
parent 9ccfbd7acb
commit 0e6b2bbf5c
No known key found for this signature in database
GPG Key ID: 37689350E9CD0F0D

@ -26,7 +26,7 @@ func AddAccountSession(username string, token []byte) error {
func GetUsernameFromToken(token []byte) (string, error) {
var username string
err := handle.QueryRow("SELECT a.username FROM accounts a JOIN sessions s ON s.uuid = a.uuid WHERE s.token = ? AND s.expire > UTC_TIMESTAMP()").Scan(&username)
err := handle.QueryRow("SELECT a.username FROM accounts a JOIN sessions s ON s.uuid = a.uuid WHERE s.token = ? AND s.expire > UTC_TIMESTAMP()", token).Scan(&username)
if err != nil {
if err == sql.ErrNoRows {
return "", err

Loading…
Cancel
Save