app/models/user.rb in hackathon_manager-0.6.6 vs app/models/user.rb in hackathon_manager-0.7.0
- old
+ new
@@ -39,10 +39,12 @@
return "" if questionnaire.blank?
questionnaire.full_name
end
def self.from_omniauth(auth)
- where(provider: auth.provider, uid: auth.uid).first_or_create do |user|
+ matching_provider = where(provider: auth.provider, uid: auth.uid)
+ matching_email = where(email: auth.info.email)
+ matching_provider.or(matching_email).first_or_create do |user|
user.uid = auth.uid
user.email = auth.info.email
user.password = Devise.friendly_token[0, 20]
end
end