refactoring login form