Extended the login function to take username and password.