mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 03:00:33 +02:00
Make use of email_domain in sign up approval check (#38199)
This commit is contained in:
@@ -463,18 +463,15 @@ class User < ApplicationRecord
|
||||
end
|
||||
|
||||
def sign_up_email_requires_approval?
|
||||
return false if email.blank?
|
||||
|
||||
_, domain = email.split('@', 2)
|
||||
return false if domain.blank?
|
||||
return false if email_domain.blank?
|
||||
|
||||
records = []
|
||||
|
||||
# Doing this conditionally is not very satisfying, but this is consistent
|
||||
# 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
|
||||
|
||||
def sign_up_username_requires_approval?
|
||||
|
||||
Reference in New Issue
Block a user