Moved generation of user login token to it's own function
Made some formatting enhancements
Added error message handling for failed authentication