mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 00:12:03 +02:00
Registrant domain update confirmation
This commit is contained in:
parent
254849494f
commit
ee39181094
16 changed files with 236 additions and 10 deletions
|
@ -1,12 +1,40 @@
|
|||
class Registrant::DomainUpdateConfirmsController < RegistrantController
|
||||
skip_before_action :authenticate_user!, only: [:show, :create]
|
||||
skip_authorization_check only: [:show, :create]
|
||||
skip_before_action :authenticate_user!, only: [:show, :update]
|
||||
skip_authorization_check only: [:show, :update]
|
||||
|
||||
def show
|
||||
return if params[:confirmed] || params[:rejected]
|
||||
@domain = Domain.find(params[:id])
|
||||
@domain = nil unless @domain.registrant_update_confirmable?(params[:token])
|
||||
end
|
||||
|
||||
def create
|
||||
def update
|
||||
@domain = Domain.find(params[:id])
|
||||
unless @domain.registrant_update_confirmable?(params[:token])
|
||||
flash[:alert] = t(:registrant_domain_verification_failed)
|
||||
return render 'show'
|
||||
end
|
||||
|
||||
@registrant_verification = RegistrantVerification.new(domain_id: @domain.id,
|
||||
domain_name: @domain.name,
|
||||
verification_token: params[:token])
|
||||
|
||||
if params[:rejected]
|
||||
if @registrant_verification.domain_registrant_change_reject!
|
||||
flash[:notice] = t(:registrant_domain_verification_rejected)
|
||||
redirect_to registrant_domain_update_confirm_path(@domain.id, rejected: true)
|
||||
else
|
||||
flash[:alert] = t(:registrant_domain_verification_rejected_failed)
|
||||
return render 'show'
|
||||
end
|
||||
elsif params[:confirmed]
|
||||
if @registrant_verification.domain_registrant_change_confirm!
|
||||
flash[:notice] = t(:registrant_domain_verification_confirmed)
|
||||
redirect_to registrant_domain_update_confirm_path(@domain.id, confirmed: true)
|
||||
else
|
||||
flash[:alert] = t(:registrant_domain_verification_confirmed_failed)
|
||||
return render 'show'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue