allows creating email duplicates while registering with omniauth

This commit is contained in:
kikito
2016-01-25 18:55:08 +01:00
parent 1617f7295c
commit 55216ba431

View File

@@ -174,6 +174,11 @@ class User < ActiveRecord::Base
!erased? && !registering_with_oauth
end
# Deactivates the email uniqueness validation when registering with oauth
def email_changed?
!registering_with_oauth && super
end
def has_official_email?
domain = Setting['email_domain_for_officials']
!email.blank? && ( (email.end_with? "@#{domain}") || (email.end_with? ".#{domain}") )