refactored login.js to use userProfile Object