Refactoring of login methods