mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 00:42:04 +02:00
Registrant domain delete confirmation #2557
This commit is contained in:
parent
f34a7193d4
commit
912ad63fd7
7 changed files with 130 additions and 16 deletions
|
@ -1,12 +1,43 @@
|
|||
class Registrant::DomainDeleteConfirmsController < 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_delete_confirmable?(params[:token])
|
||||
end
|
||||
|
||||
def create
|
||||
# # rubocop: disable Metrics/PerceivedComplexity
|
||||
# # rubocop: disable Metrics/CyclomaticComplexity
|
||||
def update
|
||||
@domain = Domain.find(params[:id])
|
||||
unless @domain.registrant_delete_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_delete_reject!
|
||||
flash[:notice] = t(:registrant_domain_verification_rejected)
|
||||
redirect_to registrant_domain_delete_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_delete_confirm!
|
||||
flash[:notice] = t(:registrant_domain_verification_confirmed)
|
||||
redirect_to registrant_domain_delete_confirm_path(@domain.id, confirmed: true)
|
||||
else
|
||||
flash[:alert] = t(:registrant_domain_verification_confirmed_failed)
|
||||
return render 'show'
|
||||
end
|
||||
end
|
||||
end
|
||||
# rubocop: enable Metrics/PerceivedComplexity
|
||||
# rubocop: enable Metrics/CyclomaticComplexity
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue