From fab2b95ab646fb029a1c3f0069d11f71117b2f6f Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Thu, 23 Oct 2014 22:55:49 +0530 Subject: [PATCH] FIX: disposable invite was giving email validation error --- lib/validators/email_validator.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/validators/email_validator.rb b/lib/validators/email_validator.rb index 0b612ab565..6f3e8872e0 100644 --- a/lib/validators/email_validator.rb +++ b/lib/validators/email_validator.rb @@ -10,7 +10,7 @@ class EmailValidator < ActiveModel::EachValidator record.errors.add(attribute, I18n.t(:'user.email.not_allowed')) end end - if record.errors[attribute].blank? and ScreenedEmail.should_block?(value) + if record.errors[attribute].blank? && value && ScreenedEmail.should_block?(value) record.errors.add(attribute, I18n.t(:'user.email.blocked')) end end @@ -25,4 +25,4 @@ class EmailValidator < ActiveModel::EachValidator /^[a-zA-Z0-9!#\$%&'*+\/=?\^_`{|}~\-]+(?:\.[a-zA-Z0-9!#\$%&'\*+\/=?\^_`{|}~\-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/ end -end \ No newline at end of file +end