changed validation email principles

This commit is contained in:
olegphenomenon 2022-03-18 17:56:39 +02:00
parent 89bc8583ba
commit c972308f03
2 changed files with 1 additions and 12 deletions

View file

@ -92,7 +92,6 @@ class Registrar
def create def create
authorize! :create, Depp::Domain authorize! :create, Depp::Domain
@domain_params = domain_params.to_h @domain_params = domain_params.to_h
# @data = @domain.create(@domain_params) if emails_valid?
@data = @domain.create(@domain_params) @data = @domain.create(@domain_params)
if @data && response_ok? if @data && response_ok?
@ -113,10 +112,8 @@ class Registrar
def update def update
authorize! :update, Depp::Domain authorize! :update, Depp::Domain
@domain_params = params[:domain] @domain_params = params[:domain]
# if emails_valid?
@data = @domain.update(@domain_params) @data = @domain.update(@domain_params)
@dispute = Dispute.active.find_by(domain_name: @domain_params[:name]) @dispute = Dispute.active.find_by(domain_name: @domain_params[:name])
# end
if @data && response_ok? if @data && response_ok?
redirect_to info_registrar_domains_url(domain_name: @domain_params[:name]) redirect_to info_registrar_domains_url(domain_name: @domain_params[:name])
@ -180,11 +177,6 @@ class Registrar
private private
# def emails_valid?
# params_as_hash = @domain_params[:contacts_attributes].to_h
# @emails_check_result = params_as_hash.all? { |_k, val| Contact.find_by(code: val[:code]).verify_email }
# end
def init_domain def init_domain
@domain = Depp::Domain.new(current_user: depp_current_user) @domain = Depp::Domain.new(current_user: depp_current_user)
end end

View file

@ -47,9 +47,6 @@ module Actions
contact_code = params[:registrant][:code] contact_code = params[:registrant][:code]
contact = Contact.find_by_code(contact_code) contact = Contact.find_by_code(contact_code)
p ">>>>>>>>>"
p contact.email
p ">>>>>>>>>>>>"
validate_email(contact.email) validate_email(contact.email)
regt = Registrant.find_by(code: params[:registrant][:code]) regt = Registrant.find_by(code: params[:registrant][:code])
@ -128,7 +125,7 @@ module Actions
end end
def validate_email(email) def validate_email(email)
return if Rails.env.test? return true if Rails.env.test?
[:regex, :mx].each do |m| [:regex, :mx].each do |m|
result = Actions::SimpleMailValidator.run(email: email, level: m) result = Actions::SimpleMailValidator.run(email: email, level: m)