trim() is a must on every user input, not only in search box.
Imagine this scenario (reral life experience):
- user change his password
- he copies and paste it from a password generator, and for mistake gets a space too
Result: he locks himself out from the system, because his password is not the one he think, but the one he think plus a space