diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index 206a78c..7cd4ee4 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -22,12 +22,11 @@ # The user is just registering the uid with us else - id = UserIdentifier.where(identifier_scheme: scheme, - identifier: request.env["omniauth.auth"].uid) - - unless current_user.user_identifiers.include?(id) - current_user.user_identifiers << id - current_user.save! + # If the user could not be found by that uid then attach it to their record + if user.email.nil? + UserIdentifier.create!(identifier_scheme: scheme, + identifier: request.env["omniauth.auth"].uid, + user: current_user) end redirect_to edit_user_registration_path