Login and logout working with window object. Passport refactored and logic moved