mirror of
https://github.com/internetee/registry.git
synced 2025-07-02 17:23:34 +02:00
Use BaseController in admin
This commit is contained in:
parent
cee4c84edd
commit
a63b989cd6
36 changed files with 1265 additions and 1215 deletions
|
@ -1,41 +1,43 @@
|
|||
class Admin::PendingUpdatesController < AdminController
|
||||
before_action :find_domain
|
||||
before_action :check_status
|
||||
module Admin
|
||||
class PendingUpdatesController < BaseController
|
||||
before_action :find_domain
|
||||
before_action :check_status
|
||||
|
||||
def update
|
||||
authorize! :update, :pending
|
||||
def update
|
||||
authorize! :update, :pending
|
||||
|
||||
if registrant_verification.domain_registrant_change_confirm!("admin #{current_user.username}")
|
||||
redirect_to admin_domain_path(@domain.id), notice: t(:pending_applied)
|
||||
else
|
||||
redirect_to edit_admin_domain_path(@domain.id), alert: t(:failure)
|
||||
if registrant_verification.domain_registrant_change_confirm!("admin #{current_user.username}")
|
||||
redirect_to admin_domain_path(@domain.id), notice: t(:pending_applied)
|
||||
else
|
||||
redirect_to edit_admin_domain_path(@domain.id), alert: t(:failure)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
authorize! :destroy, :pending
|
||||
if registrant_verification.domain_registrant_change_reject!("admin #{current_user.username}")
|
||||
redirect_to admin_domain_path(@domain.id), notice: t(:pending_removed)
|
||||
else
|
||||
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
|
||||
def destroy
|
||||
authorize! :destroy, :pending
|
||||
if registrant_verification.domain_registrant_change_reject!("admin #{current_user.username}")
|
||||
redirect_to admin_domain_path(@domain.id), notice: t(:pending_removed)
|
||||
else
|
||||
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
|
||||
end
|
||||
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
|
||||
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
|
||||
private
|
||||
|
||||
def find_domain
|
||||
@domain = Domain.find(params[:domain_id])
|
||||
end
|
||||
def find_domain
|
||||
@domain = Domain.find(params[:domain_id])
|
||||
end
|
||||
|
||||
def check_status
|
||||
return redirect_to admin_domain_path(@domain.id), alert: t(:something_wrong) unless @domain.pending_update?
|
||||
def check_status
|
||||
return redirect_to admin_domain_path(@domain.id), alert: t(:something_wrong) unless @domain.pending_update?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue