56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/simple_captcha/active_record.rb', line 56
def is_captcha_valid?
return true if Rails.env.test?
if captcha && captcha.upcase.delete(" ") == SimpleCaptcha::Utils::simple_captcha_value(captcha_key)
SimpleCaptcha::Utils::simple_captcha_passed!(captcha_key)
return true
else
message = simple_captcha_options[:message] || I18n.t(self.class.model_name.downcase, :scope => [:simple_captcha, :message], :default => :default)
simple_captcha_options[:add_to_base] ? errors.add(:base, message) : errors.add(:captcha, message)
return false
end
end
|