Fixed the login and added login test