Finished the behind code for login