completed the login functionality