Common code refactoring related to Login process