WIP Speed up login part1

Closed username-removed-25949 requested to merge haynes/gitlab-ce:speedup-login-part1 into master

This MR speeds up the User.by_login method a little bit.
It moves the logic to ruby so the db doesn't have to compare two slow fields.

See https://gitlab.com/gitlab-org/gitlab-ce/issues/2341#note_2146984

cc @jacobvosmaer