about summary refs log tree commit diff
path: root/app/validators
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-05-04 16:37:26 +0200
committerThibaut Girka <thib@sitedethib.com>2019-05-04 16:37:26 +0200
commit33c80e07838d932efc6214cb1642cefaeb624b67 (patch)
tree51cae2d9096888cc27ae38ec4b0ceceb1853bb73 /app/validators
parent2c2f649200ba5b742ba9d17ac5ba553c752b59aa (diff)
parentc88d9e524b02cba895de9bdb7cba0e29e37703d5 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- app/models/media_attachment.rb
Diffstat (limited to 'app/validators')
-rw-r--r--app/validators/blacklisted_email_validator.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/validators/blacklisted_email_validator.rb b/app/validators/blacklisted_email_validator.rb
index a2061fdd3..a288c20ef 100644
--- a/app/validators/blacklisted_email_validator.rb
+++ b/app/validators/blacklisted_email_validator.rb
@@ -2,7 +2,10 @@
 
 class BlacklistedEmailValidator < ActiveModel::Validator
   def validate(user)
+    return if user.invited?
+
     @email = user.email
+
     user.errors.add(:email, I18n.t('users.invalid_email')) if blocked_email?
   end
 
@@ -13,7 +16,7 @@ class BlacklistedEmailValidator < ActiveModel::Validator
   end
 
   def on_blacklist?
-    return true if EmailDomainBlock.block?(@email)
+    return true  if EmailDomainBlock.block?(@email)
     return false if Rails.configuration.x.email_domains_blacklist.blank?
 
     domains = Rails.configuration.x.email_domains_blacklist.gsub('.', '\.')