Implemented the login functionality