diff --git a/main.go b/main.go index cc7e272..30cd0d9 100644 --- a/main.go +++ b/main.go @@ -7,13 +7,14 @@ import ( "encoding/base32" "encoding/json" "fmt" - "github.com/jmoiron/sqlx" - "golang.org/x/crypto/bcrypt" "html/template" "log" "net/smtp" "strings" "time" + + "github.com/jmoiron/sqlx" + "golang.org/x/crypto/bcrypt" ) type templates struct { @@ -195,7 +196,7 @@ func SaveUser(username string, d UserData) bool { func Bump(username string, ip string) { username = strings.ToLower(username) - q := fmt.Sprintf("update %s_auth set lastseen=CURRENT_TIMESTAMP, lastseenip=$2 where username = $1", c.TablePrefix) + q := fmt.Sprintf("update %s_auth set lastseen=CURRENT_TIMESTAMP, lastseenip=$2 where username = $1 limit 1", c.TablePrefix) _, err := c.db.Exec(q, username, ip) if err != nil { log.Printf("scsusers.Bump: Error on user bump: %s : %s\n", username, err.Error())