Created regex only email validation domain list

This commit is contained in:
Sergei Tsõganov 2022-07-13 12:02:50 +03:00
parent e17b21436d
commit 48726c3a9a
2 changed files with 5 additions and 0 deletions

View file

@ -182,6 +182,8 @@ tara_rant_secret: 'secret'
tara_rant_redirect_uri: 'redirect_uri'
default_email_validation_type: 'mx'
# You can predefine regex only validation for domains (default value ''):
regex_only_email_validations: 'somedomain.com, otherdomain.com'
default_connection_timeout: '1'
default_response_timeout: '1'

View file

@ -48,6 +48,9 @@ Truemail.configure do |config|
# And all of validations for 'otherdomain.com' will be processed with mx validation only.
# It is equal to empty hash by default.
# config.validation_type_for = { 'somedomain.com' => :regex, 'otherdomain.com' => :mx }
config.validation_type_for = ENV['regex_only_email_validations'].split(/,/)
.collect { |d| [d.strip, :regex] }
.to_h
# Optional parameter. Validation of email which contains whitelisted domain always will
# return true. Other validations will not processed even if it was defined in validation_type_for