about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-08-01 23:25:19 -0500
committermultiple creatures <dev@multiple-creature.party>2019-08-01 23:25:19 -0500
commita6e34404a2aa3adfe032ed5ba852750ae92decc4 (patch)
tree1e3d2047809738ebbb732185e844bb996b303e1c /app/controllers
parent0e87431d61e41d51a5ddccb6b4b79d45b002a9b1 (diff)
strip params
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/admin/domain_blocks_controller.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/admin/domain_blocks_controller.rb b/app/controllers/admin/domain_blocks_controller.rb
index d0858006a..afba387cc 100644
--- a/app/controllers/admin/domain_blocks_controller.rb
+++ b/app/controllers/admin/domain_blocks_controller.rb
@@ -6,14 +6,16 @@ module Admin
 
     def new
       authorize :domain_block, :create?
-      @domain_block = DomainBlock.new(domain: params[:_domain])
+      @domain_block = DomainBlock.new(domain: params[:_domain].present? ? params[:_domain].strip : nil)
     end
 
     def create
       authorize :domain_block, :create?
 
+      resource_params[:domain].strip! if resource_params[:domain].present?
+      resource_params[:reason].strip! if resource_params[:reason].present?
       @domain_block = DomainBlock.new(resource_params)
-      existing_domain_block = resource_params[:domain].present? ? DomainBlock.find_by(domain: resource_params[:domain]) : nil
+      existing_domain_block = resource_params[:domain].present? ? DomainBlock.find_by(domain: resource_params[:domain].strip) : nil
 
       if existing_domain_block.present?
         @domain_block = existing_domain_block
@@ -43,6 +45,7 @@ module Admin
 
     def update
       return destroy unless resource_params[:undo].to_i.zero?
+      resource_params[:reason].strip! if resource_params[:reason].present?
       authorize @domain_block, :update?
       @domain_block.update(resource_params.except(:domain, :undo))
       changed = @domain_block.changed