aboutsummaryrefslogtreecommitdiff
path: root/models/user.go
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-10-25 07:50:19 -0400
committerUnknwon <joe2010xtmf@163.com>2014-10-25 07:50:19 -0400
commit83283bca4cb4e0f4ec48a28af680f0d88db3d2c8 (patch)
tree665b81c242a4d92811568367eb53dc3ba5eb1247 /models/user.go
parentf1d87462642aa0ab4ce61e8a285e3a288b4dc119 (diff)
Safe work
Diffstat (limited to 'models/user.go')
-rw-r--r--models/user.go8
1 files changed, 1 insertions, 7 deletions
diff --git a/models/user.go b/models/user.go
index 6b0f796b..ce85008b 100644
--- a/models/user.go
+++ b/models/user.go
@@ -574,13 +574,7 @@ func GetUserByEmail(email string) (*User, error) {
// SearchUserByName returns given number of users whose name contains keyword.
func SearchUserByName(opt SearchOption) (us []*User, err error) {
- // Prevent SQL inject.
- opt.Keyword = strings.TrimSpace(opt.Keyword)
- if len(opt.Keyword) == 0 {
- return us, nil
- }
-
- opt.Keyword = strings.Split(opt.Keyword, " ")[0]
+ opt.Keyword = FilterSQLInject(opt.Keyword)
if len(opt.Keyword) == 0 {
return us, nil
}