Implemented login functionality. Modified registration function for
async communication