From f561014aa84428df4ea2e348a445aab8e8061657 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 16 Mar 2026 04:34:18 -0400 Subject: [PATCH] Make use of `email_domain` in sign up approval check (#38199) --- app/models/user.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index f1ac710e8e..dd029d8e08 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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?