Mercurial > zeropaste
changeset 297:dff632a63ada
Basic spam filtering.
author | edogawaconan <me@myconan.net> |
---|---|
date | Wed, 12 Feb 2014 14:27:17 +0900 |
parents | 59be20065799 |
children | ff27821f9272 |
files | app/assets/stylesheets/pastes.css app/controllers/application_controller.rb app/views/pastes/_form.html.erb app/views/shared/_filter_spam.html.erb |
diffstat | 4 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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; +}
--- 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
--- 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" %> </div></div> </div> + <%= render 'shared/filter_spam' %> <div class="checkbox"> <%= f.label :is_private do %> <%= f.check_box :is_private %>