Make use of email_domain in sign up approval check (#38199)
This commit is contained in:
@@ -463,18 +463,15 @@ class User < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def sign_up_email_requires_approval?
|
def sign_up_email_requires_approval?
|
||||||
return false if email.blank?
|
return false if email_domain.blank?
|
||||||
|
|
||||||
_, domain = email.split('@', 2)
|
|
||||||
return false if domain.blank?
|
|
||||||
|
|
||||||
records = []
|
records = []
|
||||||
|
|
||||||
# Doing this conditionally is not very satisfying, but this is consistent
|
# Doing this conditionally is not very satisfying, but this is consistent
|
||||||
# with the MX records validations we do and keeps the specs tractable.
|
# with the MX records validations we do and keeps the specs tractable.
|
||||||
records = DomainResource.new(domain).mx unless self.class.skip_mx_check?
|
records = DomainResource.new(email_domain).mx unless self.class.skip_mx_check?
|
||||||
|
|
||||||
EmailDomainBlock.requires_approval?(records + [domain], attempt_ip: sign_up_ip)
|
EmailDomainBlock.requires_approval?(records + [email_domain], attempt_ip: sign_up_ip)
|
||||||
end
|
end
|
||||||
|
|
||||||
def sign_up_username_requires_approval?
|
def sign_up_username_requires_approval?
|
||||||
|
|||||||
Reference in New Issue
Block a user