mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
Added domain confirmation verification url
This commit is contained in:
parent
8b392fcc56
commit
6821afff65
8 changed files with 33 additions and 7 deletions
|
@ -0,0 +1,16 @@
|
|||
class Registrant::DomainUpdateConfirmsController < RegistrantController
|
||||
skip_before_action :authenticate_user!, only: [:show, :create]
|
||||
skip_authorization_check only: [:show, :create]
|
||||
|
||||
def show
|
||||
@domain = Domain.find(params[:id])
|
||||
|
||||
if @domain.present? && params[:token].present? && @domain.registrant_verification_token == params[:token]
|
||||
else
|
||||
@domain = nil
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
end
|
||||
end
|
|
@ -10,7 +10,9 @@ class DomainMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
@old_registrant = Registrant.find(@domain.registrant_id_was)
|
||||
@verification_url = "#{ENV['registrant_url']}/etc/"
|
||||
|
||||
confirm_path = "#{ENV['registrant_url']}/registrant/domain_update_confirms"
|
||||
@verification_url = "#{confirm_path}/#{@domain.id}?token=#{@domain.registrant_verification_token}"
|
||||
|
||||
mail(to: @old_registrant.email,
|
||||
subject: "#{I18n.t(:domain_registrant_update_subject, name: @domain.name)} [#{@domain.name}]")
|
||||
|
|
|
@ -18,7 +18,9 @@ class Ability
|
|||
registrant
|
||||
end
|
||||
|
||||
# Public user
|
||||
can :show, :dashboard
|
||||
can :create, :registrant_domain_update_confirm
|
||||
end
|
||||
|
||||
# rubocop: disable Metrics/CyclomaticComplexity
|
||||
|
@ -67,7 +69,7 @@ class Ability
|
|||
end
|
||||
|
||||
def registrant
|
||||
can :manage, Registrant::Whois
|
||||
can :manage, :registrant_whois
|
||||
can :manage, Depp::Domain
|
||||
end
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ Linn: <%= @domain.registrant_city %><br>
|
|||
Riik: <%= @domain.registrant_country %>
|
||||
<br><br>
|
||||
Muudatuse kinnitamiseks külastage palun allolevat võrgulehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan:<br>
|
||||
<%= @verification_url %>
|
||||
<%= link_to @verification_url, @verification_url %>
|
||||
<br><br>
|
||||
Lugupidamisega<br>
|
||||
Eesti Interneti SA
|
||||
|
@ -41,7 +41,7 @@ City: <%= @domain.registrant_city %><br>
|
|||
Country: <%= @domain.registrant_country %>
|
||||
<br><br>
|
||||
To confirm the update please visit this website, once again review the data and press approve:<br>
|
||||
<%= @verification_url %>
|
||||
<%= link_to @verification_url, @verification_url %>
|
||||
<br><br>
|
||||
Best Regards,<br>
|
||||
Estonian Internet Foundation
|
||||
|
|
2
app/views/registrant/domain_update_confirms/show.haml
Normal file
2
app/views/registrant/domain_update_confirms/show.haml
Normal file
|
@ -0,0 +1,2 @@
|
|||
- if @domain.blank?
|
||||
%h1= t(:not_valid_domain_verification)
|
|
@ -768,3 +768,4 @@ en:
|
|||
domain_registrant_update_subject: "Kinnitustaotlus domeeni %{name} registreerija vahetuseks / Application for approval for registrant chache of %{name}"
|
||||
whois: WHOIS
|
||||
login_failed_check_id_card: 'Log in failed, check ID card'
|
||||
not_valid_domain_verification: Not valid domain update verification
|
||||
|
|
|
@ -103,6 +103,8 @@ Rails.application.routes.draw do
|
|||
# resources :deposits
|
||||
# resources :account_activities
|
||||
|
||||
resources :domain_update_confirms
|
||||
|
||||
devise_scope :user do
|
||||
get 'login' => 'sessions#login'
|
||||
get 'login/mid' => 'sessions#login_mid'
|
||||
|
|
|
@ -31,10 +31,7 @@ describe DomainMailer do
|
|||
@new_registrant = Fabricate(:registrant, email: 'test@example.org')
|
||||
@domain = Fabricate(:domain, registrant: @registrant)
|
||||
@domain.deliver_emails = true
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
@domain.registrant_verification_token = '123'
|
||||
>>>>>>> 0ddd2b6f32fa7e9abec8b2e7c88173585a78f3dd
|
||||
@domain.registrant = @new_registrant
|
||||
@mail = DomainMailer.registrant_updated(@domain)
|
||||
end
|
||||
|
@ -54,5 +51,9 @@ describe DomainMailer do
|
|||
it 'should render body' do
|
||||
@mail.body.encoded.should =~ /Registrisse laekus taotlus domeeni/
|
||||
end
|
||||
|
||||
it 'should render verification url' do
|
||||
@mail.body.encoded.should =~ /registrant\/domain_update_confirms/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue