Fix query in GetUsernameFromToken
parent
9ccfbd7acb
commit
0e6b2bbf5c
|
@ -26,7 +26,7 @@ func AddAccountSession(username string, token []byte) error {
|
||||||
|
|
||||||
func GetUsernameFromToken(token []byte) (string, error) {
|
func GetUsernameFromToken(token []byte) (string, error) {
|
||||||
var username string
|
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 != nil {
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
return "", err
|
return "", err
|
||||||
|
|
Loading…
Reference in New Issue