kate: remove trailing spaces
Move User retrieval code to db.User

- It logically belongs here.
- Fix a typo.