From dce585344eefbcccf934622b6da5c30c6ea14fd5 Mon Sep 17 00:00:00 2001 From: Stas Date: Sun, 10 Jul 2016 22:44:56 +0300 Subject: [PATCH] 115693873-initiator_fix --- .../registrant/domain_delete_confirms_controller.rb | 7 +++++-- .../registrant/domain_update_confirms_controller.rb | 7 +++++-- config/locales/en.yml | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/controllers/registrant/domain_delete_confirms_controller.rb b/app/controllers/registrant/domain_delete_confirms_controller.rb index ae4d8cb5f..bfc481771 100644 --- a/app/controllers/registrant/domain_delete_confirms_controller.rb +++ b/app/controllers/registrant/domain_delete_confirms_controller.rb @@ -20,8 +20,11 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController @registrant_verification = RegistrantVerification.new(domain_id: @domain.id, domain_name: @domain.name, verification_token: params[:token]) + + initiator = current_user ? current_user.username : t(:user_not_authorized) + if params[:rejected] - if @registrant_verification.domain_registrant_delete_reject!("email link #{current_user.username}") + if @registrant_verification.domain_registrant_delete_reject!("email link #{initiator}") flash[:notice] = t(:registrant_domain_verification_rejected) redirect_to registrant_domain_delete_confirm_path(@domain.id, rejected: true) else @@ -29,7 +32,7 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController return render 'show' end elsif params[:confirmed] - if @registrant_verification.domain_registrant_delete_confirm!("email link #{current_user.username}") + if @registrant_verification.domain_registrant_delete_confirm!("email link #{initiator}") flash[:notice] = t(:registrant_domain_verification_confirmed) redirect_to registrant_domain_delete_confirm_path(@domain.id, confirmed: true) else diff --git a/app/controllers/registrant/domain_update_confirms_controller.rb b/app/controllers/registrant/domain_update_confirms_controller.rb index 75f313ea8..daa695818 100644 --- a/app/controllers/registrant/domain_update_confirms_controller.rb +++ b/app/controllers/registrant/domain_update_confirms_controller.rb @@ -20,8 +20,11 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController @registrant_verification = RegistrantVerification.new(domain_id: @domain.id, domain_name: @domain.name, verification_token: params[:token]) + + initiator = current_user ? current_user.username : t(:user_not_authorized) + if params[:rejected] - if @registrant_verification.domain_registrant_change_reject!("email link #{current_user.username}") + if @registrant_verification.domain_registrant_change_reject!("email link, #{initiator}") flash[:notice] = t(:registrant_domain_verification_rejected) redirect_to registrant_domain_update_confirm_path(@domain.id, rejected: true) else @@ -29,7 +32,7 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController return render 'show' end elsif params[:confirmed] - if @registrant_verification.domain_registrant_change_confirm!("email link #{current_user.username}") + if @registrant_verification.domain_registrant_change_confirm!("email link, #{initiator}") flash[:notice] = t(:registrant_domain_verification_confirmed) redirect_to registrant_domain_update_confirm_path(@domain.id, confirmed: true) else diff --git a/config/locales/en.yml b/config/locales/en.yml index a807c53e8..1da83d9d5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -940,3 +940,4 @@ en: edit_pw: 'Edit Pw' optional: 'Optional' test_registrar: "Test registrar" + user_not_authorized: "user not authorized"