mirror of
https://github.com/internetee/registry.git
synced 2025-06-09 22:24:47 +02:00
added trumail validator after update and implement simple email validator interaction
This commit is contained in:
parent
00bb2ffb45
commit
41feb7c601
2 changed files with 27 additions and 0 deletions
|
@ -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?
|
||||
|
||||
|
|
9
app/interactions/actions/simple_mail_validator.rb
Normal file
9
app/interactions/actions/simple_mail_validator.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
module Actions
|
||||
module SimpleMailValidator
|
||||
extend self
|
||||
|
||||
def run(email:, level:)
|
||||
Truemail.validate(email, with: level).result
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue