Be more permissive in UserLookupGET (wildcard both at start and at end of username)

This commit is contained in:
Howl 2016-05-17 17:40:30 +02:00
parent c86bc1e420
commit 5320c62e17

View File

@ -301,7 +301,7 @@ func UserLookupGET(md common.MethodData) common.CodeMessager {
if name == "" { if name == "" {
return common.SimpleResponse(400, "please provide an username to start searching") return common.SimpleResponse(400, "please provide an username to start searching")
} }
name += "%" name = "%" + name + "%"
rows, err := md.DB.Query("SELECT users.id, users.username FROM users WHERE username LIKE ? AND allowed = '1' LIMIT 25", name) rows, err := md.DB.Query("SELECT users.id, users.username FROM users WHERE username LIKE ? AND allowed = '1' LIMIT 25", name)
if err != nil { if err != nil {
md.Err(err) md.Err(err)