Added registration to user login and updated error handling.