diff options
Diffstat (limited to 'models/user.go')
-rw-r--r-- | models/user.go | 8 |
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 } |