Added more funtionality to the login function in the JS file