# HG changeset patch # User edogawaconan # Date 1392182837 -32400 # Node ID dff632a63ada213d335ea4ebba43a1b77b55d872 # Parent 59be2006579964e183e92c50e4c8e88cffb103cd Basic spam filtering. diff -r 59be20065799 -r dff632a63ada app/assets/stylesheets/pastes.css --- a/app/assets/stylesheets/pastes.css Wed Feb 12 14:08:47 2014 +0900 +++ b/app/assets/stylesheets/pastes.css Wed Feb 12 14:27:17 2014 +0900 @@ -19,3 +19,7 @@ #paste_key { border-radius: 4px 0 0 4px; } + +.input-url1 { + display: none; +} diff -r 59be20065799 -r dff632a63ada app/controllers/application_controller.rb --- a/app/controllers/application_controller.rb Wed Feb 12 14:08:47 2014 +0900 +++ b/app/controllers/application_controller.rb Wed Feb 12 14:27:17 2014 +0900 @@ -1,3 +1,10 @@ class ApplicationController < ActionController::Base protect_from_forgery + before_action :filter_spam + + private + + def filter_spam + head :ok if params[:url1].present? + end end diff -r 59be20065799 -r dff632a63ada app/views/pastes/_form.html.erb --- a/app/views/pastes/_form.html.erb Wed Feb 12 14:08:47 2014 +0900 +++ b/app/views/pastes/_form.html.erb Wed Feb 12 14:27:17 2014 +0900 @@ -9,6 +9,7 @@ <%= f.text_field :key, :class => "form-control" %> + <%= render 'shared/filter_spam' %>
<%= f.label :is_private do %> <%= f.check_box :is_private %> diff -r 59be20065799 -r dff632a63ada app/views/shared/_filter_spam.html.erb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/views/shared/_filter_spam.html.erb Wed Feb 12 14:27:17 2014 +0900 @@ -0,0 +1,4 @@ +
+ + +