simple login refactoring