refactoring Login