Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin contacts requirements #2743

Merged
merged 12 commits into from
Jan 31, 2025
2 changes: 1 addition & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
- name: Save coverage
run: ./cc-test-reporter format-coverage --output coverage/codeclimate.${{ matrix.ruby }}.json

- uses: actions/upload-artifact@v4.5.0
- uses: actions/upload-artifact@v4.6.0
with:
name: coverage-${{ matrix.ruby }}
path: coverage/codeclimate.${{ matrix.ruby }}.json
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.6
3.0.3
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
28.01.2025
* Adding technical contact is now optional https://github.com/internetee/registry/issues/2701
* Adding admin contact is now optional for private regsitrants https://github.com/internetee/registry/issues/2702

15.01.2025
* Removed Russian transaltios from the automated email templates https://github.com/internetee/registry/issues/2690
* Improved verification email translations https://github.com/internetee/registry/pull/2737

31.12.2024
* Fix for expired status in domain history https://github.com/internetee/registry/issues/2665
* Fix for lifting ForceDelete https://github.com/internetee/registry/pull/2670
Expand Down
2 changes: 1 addition & 1 deletion app/interactions/actions/domain_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def call
assign_registrant
assign_nameservers
assign_domain_contacts
domain.attach_default_contacts
# domain.attach_default_contacts
assign_expiry_time
maybe_attach_legal_doc

Expand Down
2 changes: 1 addition & 1 deletion app/mailers/registrar_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class RegistrarMailer < ApplicationMailer

def contact_verified(email:, contact:, poi:)
@contact = contact
subject = 'Successful Contact Verification'
subject = default_i18n_subject(contact_code: contact.code)
attachments['proof_of_identity.pdf'] = poi
mail(to: email, subject: subject)
end
Expand Down
57 changes: 55 additions & 2 deletions app/models/domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def self.admin_contacts_validation_rules(for_org:)

def self.tech_contacts_validation_rules(for_org:)
{
min: -> { for_org ? Setting.tech_contacts_min_count : 0 },
min: -> { 0 },
max: -> { Setting.tech_contacts_max_count }
}
end
Expand Down Expand Up @@ -857,10 +857,63 @@ def self.swap_elements(array, indexes)
end

def require_admin_contacts?
registrant.present? && registrant.org?
return true if registrant.org?
return false unless registrant.priv?

underage_registrant?
end

def require_tech_contacts?
registrant.present? && registrant.org?
end

private

def underage_registrant?
case registrant.ident_type
when 'birthday'
underage_by_birthday?
when 'priv'
underage_by_estonian_id?
else
false
end
end

def underage_by_birthday?
birth_date = Date.parse(registrant.ident)
calculate_age(birth_date) < 18
end

def underage_by_estonian_id?
return false unless estonian_id?

birth_date = parse_estonian_id_birth_date(registrant.ident)
calculate_age(birth_date) < 18
end

def estonian_id?
registrant.ident_country_code == 'EE' && registrant.ident.match?(/^\d{11}$/)
end

def calculate_age(birth_date)
((Time.zone.now - birth_date.to_time) / 1.year.seconds).floor
end

def parse_estonian_id_birth_date(id_code)
century_number = id_code[0].to_i
year_digits = id_code[1..2]
month = id_code[3..4]
day = id_code[5..6]

birth_year = case century_number
when 1, 2 then "18#{year_digits}"
when 3, 4 then "19#{year_digits}"
when 5, 6 then "20#{year_digits}"
else
raise ArgumentError, "Invalid century number in Estonian ID"
end

Date.parse("#{birth_year}-#{month}-#{day}")
end
end
39 changes: 39 additions & 0 deletions app/models/epp/domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,20 @@ def check_availability(domain_names)

result
end

def admin_contacts_validation_rules(for_org:)
{
min: -> { for_org ? Setting.admin_contacts_min_count : 0 },
max: -> { Setting.admin_contacts_max_count }
}
end

def tech_contacts_validation_rules(for_org:)
{
min: 0,
max: -> { Setting.tech_contacts_max_count }
}
end
end

private
Expand All @@ -391,4 +405,29 @@ def verification_needed?(code:)

registrant.code != code
end

def admin_contacts_validation_rules(for_org:)
{
min: -> { for_org ? Setting.admin_contacts_min_count : 0 },
max: -> { Setting.admin_contacts_max_count }
}
end

def require_admin_contacts?
return true if registrant.org?
return false unless registrant.priv?

underage_registrant?
end

def tech_contacts_validation_rules(for_org:)
{
min: 0, # Технический контакт опционален для всех
max: -> { Setting.tech_contacts_max_count }
}
end

def require_tech_contacts?
registrant.present? && registrant.org?
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Teie registripidaja <%= registrar.name %> on palunud Teil kinnitada oma isikut,
<br><br>
Palun kinnitage oma isikut, et jätkata.
<br><br>
<a href="<%= @verification_link %>" style="display: inline-block; padding: 10px 20px; background-color: #007BFF; color: white; text-decoration: none; border-radius: 5px;">Jätka eeID-ga</a>
<a href="<%= @verification_link + "?ui_locales=et" %>" style="display: inline-block; padding: 10px 20px; background-color: #007BFF; color: white; text-decoration: none; border-radius: 5px;">Jätka eeID-ga</a>
<br><br>
Kontaktandmed:<br>
<%= render 'mailers/shared/registrant/registrant.et.html', registrant: contact, with_phone: true %>
Expand All @@ -24,7 +24,7 @@ Your registrar <%= registrar.name %> has requested that you verify your identity
<br><br>
Please confirm your identity to continue.
<br><br>
<a href="<%= @verification_link %>" style="display: inline-block; padding: 10px 20px; background-color: #007BFF; color: white; text-decoration: none; border-radius: 5px;">Continue with eeID</a>
<a href="<%= @verification_link + "?ui_locales=en" %>" style="display: inline-block; padding: 10px 20px; background-color: #007BFF; color: white; text-decoration: none; border-radius: 5px;">Continue with eeID</a>
<br><br>
Contact information:<br>
<%= render 'mailers/shared/registrant/registrant.en.html', registrant: contact, with_phone: true %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Tere <%= contact.name %>,

Teie registripidaja <%= registrar.name %> on palunud teil kinnitada oma isikut, et jätkata domeeni toimingutega.
Palun kinnitage oma isikut, klõpsates alloleval lingil:
<%= @verification_link %>
<%= @verification_link + "?ui_locales=et" %>

Kontaktandmed:
<%= render 'mailers/shared/registrant/registrant.et.text', registrant: contact, with_phone: true %>
Expand All @@ -21,7 +21,7 @@ Hi <%= contact.name %>,

Your registrar <%= registrar.name %> has requested that you verify your identity in order to proceed with domain actions.
Please confirm your identity to continue by clicking the link below:
<%= @verification_link %>
<%= @verification_link + "?ui_locales=en" %>

Contact information:
<%= render 'mailers/shared/registrant/registrant.en.text', registrant: contact, with_phone: true %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,3 @@
<%= render 'mailers/shared/registrar/registrar.en.html', registrar: @registrar %>
<%= render 'mailers/shared/signatures/signature.en.html' %>
<hr>

<p>Уважаемый регистрант/административный контакт домена .ee</p>

<p>Целевому учреждению Eesti Internet (EIS) стало известно, что юридическое лицо с регистрационным кодом <%= @domain.registrant.ident %> удалено из коммерческого реестра.</p>

<p>Поскольку удаленное из коммерческого регистра юридическое лицо не может являться регистрантом домена, <%= Date.today.strftime('%d.%m.%y') %> начат 45-дневный процесс удаления домена <%= @domain.name %>. Домен доступен в интернете на протяжении 15 дней после начала процесса удаления.</p>

<p>Лицо, обладающее правом на домен, может подать регистратору <%= @registrar.name %> домена <%= @domain.name %> ходатайство о передаче домена, представив вместе с ходатайством подтверждающие документы. Документы должны быть представлены регистратору в течение 45 дней.</p>

<p>Если контактные данные не будут исправлены в течение <%= @delete_period_length %> дней, домен <%= @domain.name %> отправится <%= @domain.force_delete_date %> на доменный аукцион в <a href="https://auction.internet.ee">аукционной среде.ee</a>. Если в течение 24 часов в отношении домена <%= @domain.name %> е поступит предложений, домен освободится и станет доступным для всех желающих по принципу «кто раньше». О других возможных результатах аукциона читайте <a href="https://www.internet.ee/domains/auction-environment-user-agreement#3-terms-and-conditions-for-participation-in-the-auction-of-the-auction-environment">здесь</a>.</p>

<p>В случае возникновения дополнительных вопросов свяжитесь, пожалуйста, со своим регистратором:
<%= render 'mailers/shared/registrar/registrar.ru.html', registrar: @registrar %></p>

<%= render 'mailers/shared/signatures/signature.ru.html' %>
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,3 @@
<%= render 'mailers/shared/signatures/signature.en.html' %>
<hr>

<p>Уважаемый регистрант/административный контакт домена .ee</p>

<p>Целевому учреждению Eesti Internet (EIS) стало известно, что юридическое лицо с регистрационным кодом <%= @domain.registrant.ident %> удалено из коммерческого реестра.</p>

<p>Поскольку удаленное из коммерческого регистра юридическое лицо не может являться регистрантом домена, <%= Date.today.strftime('%d.%m.%y') %> начат 45-дневный процесс удаления домена <%= @domain.name %>. Домен доступен в интернете на протяжении 15 дней после начала процесса удаления.</p>

<p>Лицо, обладающее правом на домен, может подать регистратору <%= @registrar.name %> домена <%= @domain.name %> ходатайство о передаче домена, представив вместе с ходатайством подтверждающие документы. Документы должны быть представлены регистратору в течение 45 дней.</p>

<p>Если контактные данные не будут исправлены в течение <%= @delete_period_length %> дней, домен <%= @domain.name %> отправится <%= @domain.force_delete_date %> на доменный аукцион в <a href="https://auction.internet.ee">аукционной среде.ee</a>. Если в течение 24 часов в отношении домена <%= @domain.name %> е поступит предложений, домен освободится и станет доступным для всех желающих по принципу «кто раньше». О других возможных результатах аукциона читайте <a href="https://www.internet.ee/domains/auction-environment-user-agreement#3-terms-and-conditions-for-participation-in-the-auction-of-the-auction-environment">здесь</a>.</p>

<p>В случае возникновения дополнительных вопросов свяжитесь, пожалуйста, со своим регистратором:
<%= render 'mailers/shared/registrar/registrar.ru.html', registrar: @registrar %></p>

<%= render 'mailers/shared/signatures/signature.ru.html' %>
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,3 @@
<%= render 'mailers/shared/registrar/registrar.en.html', registrar: @registrar %>
<%= render 'mailers/shared/signatures/signature.en.html' %>
<hr>

<p>Уважаемый регистрант/административный контакт домена .ee</p>

<p>Целевому учреждению Eesti Internet (EIS) стало известно, что контактные данные домена <%= @registrant.reg_no %> неверны - электронная почта <%= @domain.contact_emails_verification_failed %>.</p>

<p>Так как это является нарушением <a href='https://www.internet.ee/domains/ee-domain-regulation'>Правил домена .ee</a>, <%= @delete_period_length %>-дневный процесс удаления начат для доменного имени <%= @domain.name %>. В течение первых <%= @expire_warning_period %> дней домен будет доступен в интернете.</p>

<p>Для уточнения контактных данных, пожалуйста, свяжитесь с регистратором <%= @registrar.name %>, либо воспользуйтесь <a href="https://registrant.internet.ee/">порталом для регистрантов</a></p>

<p>Если контактные данные не будут исправлены в течение <%= @delete_period_length %> дней, домен <%= @domain.name %> отправится <%= @domain.force_delete_date %> на доменный аукцион в <a href="https://auction.internet.ee">аукционной среде.ee</a>. Если в течение 24 часов в отношении домена <%= @domain.name %> е поступит предложений, домен освободится и станет доступным для всех желающих по принципу «кто раньше». О других возможных результатах аукциона читайте <a href="https://www.internet.ee/domains/auction-environment-user-agreement#3-terms-and-conditions-for-participation-in-the-auction-of-the-auction-environment">здесь</a>.</p>

<p>В случае возникновения дополнительных вопросов свяжитесь, пожалуйста, со своим регистратором:
<%= render 'mailers/shared/registrar/registrar.ru.html', registrar: @registrar %></p>

<%= render 'mailers/shared/signatures/signature.ru.html' %>
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,3 @@
<%= render 'mailers/shared/registrar/registrar.en.html', registrar: @registrar %>
<%= render 'mailers/shared/signatures/signature.en.html' %>
<hr>

<p>Уважаемый регистрант/административный контакт домена .ee</p>

<p>Целевому учреждению Eesti Internet (EIS) стало известно, что контактные данные домена <%= @registrant.reg_no %> неверны - электронная почта <%= @domain.contact_emails_verification_failed %>.</p>

<p>Так как это является нарушением <a href='https://www.internet.ee/domains/ee-domain-regulation'>Правил домена .ee</a>, <%= @delete_period_length %>-дневный процесс удаления начат для доменного имени <%= @domain.name %>. В течение первых <%= @expire_warning_period %> дней домен будет доступен в интернете.</p>

<p>Для уточнения контактных данных, пожалуйста, свяжитесь с регистратором <%= @registrar.name %>, либо воспользуйтесь <a href="https://registrant.internet.ee/">порталом для регистрантов</a></p>

<p>Если контактные данные не будут исправлены в течение <%= @delete_period_length %> дней, домен <%= @domain.name %> отправится <%= @domain.force_delete_date %> на доменный аукцион в <a href="https://auction.internet.ee">аукционной среде.ee</a>. Если в течение 24 часов в отношении домена <%= @domain.name %> е поступит предложений, домен освободится и станет доступным для всех желающих по принципу «кто раньше». О других возможных результатах аукциона читайте <a href="https://www.internet.ee/domains/auction-environment-user-agreement#3-terms-and-conditions-for-participation-in-the-auction-of-the-auction-environment">здесь</a>.</p>

<p>В случае возникновения дополнительных вопросов свяжитесь, пожалуйста, со своим регистратором:
<%= render 'mailers/shared/registrar/registrar.ru.html', registrar: @registrar %></p>

<%= render 'mailers/shared/signatures/signature.ru.html' %>
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,3 @@

<%= render 'mailers/shared/signatures/signature.en.html' %>
<hr>

<p>Уважаемый регистрант/административный контакт домена .ee</p>

<p>Целевому учреждению Eesti Internet (EIS) стало известно, что контактные данные домена <%= @domain.name %> неверны - телефонные номера.</p>

<p>Так как это является нарушением <a href='https://www.internet.ee/domains/ee-domain-regulation'>Правил домена .ee</a>, <%= @delete_period_length %>-дневный процесс удаления начат для доменного имени <%= @domain.name %>. В течение первых <%= @expire_warning_period %> дней домен будет доступен в интернете.</p>

<p>Для уточнения контактных данных, пожалуйста, свяжитесь с регистратором <%= @registrar.name %>, либо воспользуйтесь <a href="https://registrant.internet.ee/">порталом для регистрантов</a></p>

<p>Если контактные данные не будут исправлены в течение <%= @delete_period_length %> дней, домен <%= @domain.name %> отправится <%= @domain.force_delete_date %> на доменный аукцион в <a href="https://auction.internet.ee">аукционной среде.ee</a>. Если в течение 24 часов в отношении домена <%= @domain.name %> е поступит предложений, домен освободится и станет доступным для всех желающих по принципу «кто раньше». О других возможных результатах аукциона читайте <a href="https://www.internet.ee/domains/auction-environment-user-agreement#3-terms-and-conditions-for-participation-in-the-auction-of-the-auction-environment">здесь</a>.</p>

<p>В случае возникновения дополнительных вопросов свяжитесь, пожалуйста, со своим регистратором:
<%= render 'mailers/shared/registrar/registrar.ru.html', registrar: @registrar %></p>

<%= render 'mailers/shared/signatures/signature.ru.html' %>
Loading
Loading