diff --git a/app/models/email_address_verification.rb b/app/models/email_address_verification.rb
index bed0cfae3..412ce7f83 100644
--- a/app/models/email_address_verification.rb
+++ b/app/models/email_address_verification.rb
@@ -30,6 +30,9 @@ class EmailAddressVerification < ApplicationRecord
if validation_request.result.success
update(verified_at: Time.zone.now,
success: true)
+ else
+ update(verified_at: nil,
+ success: false)
end
validation_request.result.success
diff --git a/app/models/registrar.rb b/app/models/registrar.rb
index 470d768b7..3fec53f21 100644
--- a/app/models/registrar.rb
+++ b/app/models/registrar.rb
@@ -13,6 +13,14 @@ class Registrar < ApplicationRecord
has_many :nameservers, through: :domains
has_many :whois_records
has_many :white_ips, dependent: :destroy
+ belongs_to :email_address_verification, class_name: 'EmailAddressVerification',
+ primary_key: 'email',
+ foreign_key: 'email',
+ optional: true
+ belongs_to :billing_email_address_verification, class_name: 'EmailAddressVerification',
+ primary_key: 'email',
+ foreign_key: 'billing_email',
+ optional: true
delegate :balance, to: :cash_account, allow_nil: true
diff --git a/app/views/admin/registrars/index.html.erb b/app/views/admin/registrars/index.html.erb
index a66816568..4b3fbd98a 100644
--- a/app/views/admin/registrars/index.html.erb
+++ b/app/views/admin/registrars/index.html.erb
@@ -28,6 +28,9 @@
<%= t(:test_registrar) %>
|
+
+ <%= t(:emails) %>
+ |
@@ -45,6 +48,16 @@
<%= "#{x.test_registrar}" %>
|
+
+ >
+ <%= "#{x.email}" %>
+
+ <% if x[:billing_email].present? %>
+ >
+ <%= "#{x[:billing_email]}" %>
+
+ <% end %>
+ |
<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a825b1dc0..27299072e 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -636,6 +636,7 @@ en:
edit_dispute: 'Edit dispute'
optional: 'Optional'
test_registrar: "Test registrar"
+ emails: 'Email addresses'
verified_confirm: 'Verified status is for cases when current registrant is the one applying for the update. Legal document signed by the registrant is required. Are you sure this update is properly verified with the registrant?'
verified: 'Verified'
deleted: 'Deleted'
diff --git a/config/locales/et.yml b/config/locales/et.yml
index 05d32be24..9cb8aaa4a 100644
--- a/config/locales/et.yml
+++ b/config/locales/et.yml
@@ -5,3 +5,4 @@ et:
date:
# Don't forget the nil at the beginning; there's no such thing as a 0th month
month_names: [~, Jaanuar, Veebruar, Märts, Aprill, Mai, Juuni, Juuli, August, September, Oktoober, November, Detsember]
+ emails: "Meillaadressid"
diff --git a/db/data/20200608084321_fill_email_verifications.rb b/db/data/20200608084321_fill_email_verifications.rb
index 7d3da34ce..68f02b133 100644
--- a/db/data/20200608084321_fill_email_verifications.rb
+++ b/db/data/20200608084321_fill_email_verifications.rb
@@ -4,12 +4,11 @@ class FillEmailVerifications < ActiveRecord::Migration[6.0]
registrar_emails = Registrar.pluck(:email).uniq.reject(&:blank?)
contact_emails = Contact.pluck(:email).uniq.reject(&:blank?)
- emails = (contact_emails || registrar_emails || registrar_billing_emails).uniq
+ emails = (contact_emails + registrar_emails + registrar_billing_emails).uniq
result = emails.map do |email|
{ email: email, domain: domain(email) }
end
-
EmailAddressVerification.import result, batch_size: 500
end
diff --git a/lib/tasks/verify_email.rake b/lib/tasks/verify_email.rake
index c97a8e39b..d069100f2 100644
--- a/lib/tasks/verify_email.rake
+++ b/lib/tasks/verify_email.rake
@@ -2,13 +2,12 @@ namespace :verify_email do
desc 'Stars verifying email jobs'
task all_domains: :environment do
verifications_by_domain = EmailAddressVerification.not_verified_recently.group_by(&:domain)
-
verifications_by_domain.each do |domain, verifications|
next if domain == 'not_found'
- ver = verifications[0] # Only first email to not to clog the SMTP servers
+ ver = verifications.sample # Verify random email to not to clog the SMTP servers
VerifyEmailsJob.enqueue(ver.id)
- # VerifyEmailsJob.run(ver.id)
+ next
end
end
end