Merge pull request #1491 from ThibG/glitch-soc/merge-upstream

Merge upstream changes
This commit is contained in:
ThibG
2021-01-26 23:21:32 +01:00
committed by GitHub
30 changed files with 41 additions and 44 deletions

View File

@@ -22,7 +22,7 @@ class BlacklistedEmailValidator < ActiveModel::Validator
domains = Rails.configuration.x.email_domains_blacklist.gsub('.', '\.')
regexp = Regexp.new("@(.+\\.)?(#{domains})", true)
@email =~ regexp
regexp.match?(@email)
end
def not_on_whitelist?

View File

@@ -15,6 +15,6 @@ class HtmlValidator < ActiveModel::EachValidator
def html_errors(str)
fragment = Nokogiri::HTML.fragment(options[:wrap_with] ? "<#{options[:wrap_with]}>#{str}</#{options[:wrap_with]}>" : str)
fragment.errors.select { |error| ERROR_RE =~ error.message }
fragment.errors.select { |error| ERROR_RE.match?(error.message) }
end
end