Updated the registration code to use username as the unique user field.