more LIMIT 1
s
This commit is contained in:
parent
aae4c5de50
commit
ea2d418a53
|
@ -111,7 +111,7 @@ func TokenNewPOST(md common.MethodData) (r common.Response) {
|
|||
ret.Token = tokenStr
|
||||
id := 0
|
||||
|
||||
err := md.DB.QueryRow("SELECT id FROM tokens WHERE token=?", tokenMD5).Scan(&id)
|
||||
err := md.DB.QueryRow("SELECT id FROM tokens WHERE token=? LIMIT 1", tokenMD5).Scan(&id)
|
||||
if err == sql.ErrNoRows {
|
||||
break
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ func UserWhatsTheIDGET(md common.MethodData) common.Response {
|
|||
id int
|
||||
allowed int
|
||||
)
|
||||
err := md.DB.QueryRow("SELECT id, allowed FROM users WHERE username = ?", md.C.Param("username")).Scan(&id, &allowed)
|
||||
err := md.DB.QueryRow("SELECT id, allowed FROM users WHERE username = ? LIMIT 1", md.C.Param("username")).Scan(&id, &allowed)
|
||||
if err != nil || allowed != 1 {
|
||||
return common.Response{
|
||||
Code: 404,
|
||||
|
|
Loading…
Reference in New Issue
Block a user