Refactored login scenario extracted login to func.