Refactor by_login and by_id_and_login in user model
This is a follow up issue of !520 (merged)
Proposal
To simplify the code, we need to do a refactor to user model in upstream and JH.
Upstream
-
combine by_login
andby_id_and_login
in to one scope -
investigate why there is an unscoped
in by_login
JH
-
sharing code between find_for_database_authentication
,by_login
andby_id_and_login