diff --git a/app/controllers/admin/pending_updates_controller.rb b/app/controllers/admin/pending_updates_controller.rb index 3a15fb3a5..6e41a6c57 100644 --- a/app/controllers/admin/pending_updates_controller.rb +++ b/app/controllers/admin/pending_updates_controller.rb @@ -5,10 +5,7 @@ class Admin::PendingUpdatesController < AdminController def update authorize! :update, :pending - @epp_domain = Epp::Domain.find(params[:domain_id]) # only epp domain has apply pending - @epp_domain.is_admin = true - - if @epp_domain.apply_pending_update! + if registrant_verification.domain_registrant_change_confirm! redirect_to admin_domain_path(@domain.id), notice: t(:pending_applied) else redirect_to edit_admin_domain_path(@domain.id), alert: t(:failure) @@ -17,14 +14,21 @@ class Admin::PendingUpdatesController < AdminController def destroy authorize! :destroy, :pending - - if @domain.clean_pendings! + if registrant_verification.domain_registrant_change_reject! redirect_to admin_domain_path(@domain.id), notice: t(:pending_removed) else redirect_to admin_domain_path(@domain.id), alert: t(:failure) end end + def registrant_verification + # steal token + token = @domain.registrant_verification_token + @registrant_verification = RegistrantVerification.new(domain_id: @domain.id, + domain_name: @domain.name, + verification_token: token) + end + private def find_domain