refactor login service