]> cat aescling's git repositories - mastodon.git/commitdiff
Fix being able to bypass e-mail restrictions (#17909)
authorEugen Rochko <eugen@zeonfederated.com>
Wed, 30 Mar 2022 12:45:52 +0000 (14:45 +0200)
committerGitHub <noreply@github.com>
Wed, 30 Mar 2022 12:45:52 +0000 (14:45 +0200)
app/models/user.rb

index f2d9c49eb973fbf14dcbaf3169f7f97529d113c1..e25c0ddb02e9abd1fc427988d063333a8a1526e6 100644 (file)
@@ -91,11 +91,11 @@ class User < ApplicationRecord
   validates :invite_request, presence: true, on: :create, if: :invite_text_required?
 
   validates :locale, inclusion: I18n.available_locales.map(&:to_s), if: :locale?
-  validates_with BlacklistedEmailValidator, on: :create
+  validates_with BlacklistedEmailValidator, if: -> { !confirmed? }
   validates_with EmailMxValidator, if: :validate_email_dns?
   validates :agreement, acceptance: { allow_nil: false, accept: [true, 'true', '1'] }, on: :create
 
-  # Those are honeypot/antispam fields
+  # Honeypot/anti-spam fields
   attr_accessor :registration_form_time, :website, :confirm_password
 
   validates_with RegistrationFormTimeValidator, on: :create