add login window at homepage and refactor