added trumail validator after update and implement simple email validator interaction

This commit is contained in:
olegphenomenon 2021-11-02 14:21:05 +02:00
parent 00bb2ffb45
commit 41feb7c601
2 changed files with 27 additions and 0 deletions

View file

@ -15,9 +15,27 @@ module Actions
maybe_update_statuses
maybe_update_ident if ident.present?
maybe_attach_legal_doc
maybe_change_email
commit
end
def maybe_change_email
return if Rails.env.test?
[:regex, :mx].each do |m|
# r = Truemail.validate(@new_attributes[:email], with: m)
r = Actions::SimpleMailValidator.run(email: @new_attributes[:email], level: m)
unless r.success
contact.add_epp_error('2306', nil, r.errors, I18n.t(:client_side_status_editing_error))
@error = true
return
end
end
true
end
def maybe_remove_address
return if Contact.address_processing?

View file

@ -0,0 +1,9 @@
module Actions
module SimpleMailValidator
extend self
def run(email:, level:)
Truemail.validate(email, with: level).result
end
end
end