Recaptcha support added when reporting screenshots
There's lots of spam recently. We need to do something against it.
This commit is contained in:
parent
85b9f1014f
commit
ff0b93380a
5 changed files with 16 additions and 4 deletions
2
Gemfile
2
Gemfile
|
|
@ -111,3 +111,5 @@ gem 'devise'
|
|||
|
||||
# Font Awesome icons
|
||||
gem "font-awesome-rails"
|
||||
|
||||
gem "recaptcha", require: "recaptcha/rails"
|
||||
|
|
|
|||
|
|
@ -208,6 +208,8 @@ GEM
|
|||
ffi (>= 0.5.0)
|
||||
rdoc (4.2.2)
|
||||
json (~> 1.4)
|
||||
recaptcha (3.3.0)
|
||||
json
|
||||
ref (2.0.0)
|
||||
responders (2.1.2)
|
||||
railties (>= 4.2.0, < 5.1)
|
||||
|
|
@ -291,6 +293,7 @@ DEPENDENCIES
|
|||
pg_search
|
||||
rails (= 4.2.0)
|
||||
rails-erd
|
||||
recaptcha
|
||||
sass-rails (~> 5.0)
|
||||
sdoc (~> 0.4.0)
|
||||
slim-rails
|
||||
|
|
|
|||
|
|
@ -177,10 +177,12 @@ class PackagesController < ApplicationController
|
|||
# Receive an anonymous report from a user to have a screenshot removed.
|
||||
def report_screenshot
|
||||
@screenshot = Screenshot.find(params[:id])
|
||||
@screenshot.delete_reason = params[:delete_reason]
|
||||
@screenshot.markedfordelete = true
|
||||
@screenshot.save!
|
||||
flash['notice'] = "Screenshot reported. The moderators will deal with it."
|
||||
if verify_recaptcha
|
||||
@screenshot.delete_reason = params[:delete_reason]
|
||||
@screenshot.markedfordelete = true
|
||||
@screenshot.save!
|
||||
flash['notice'] = "Screenshot reported. The moderators will deal with it."
|
||||
end
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -9,4 +9,5 @@
|
|||
the screenshot should get removed:
|
||||
= form_tag(report_screenshot_path(screenshot.id))
|
||||
= text_area_tag 'delete_reason', nil, class: 'input-group-field', maxlength: 100, rows: 3, cols: 50
|
||||
= recaptcha_tags
|
||||
= submit_tag 'Request removal', class: 'button alert'
|
||||
|
|
|
|||
4
config/initializers/recaptcha.rb
Normal file
4
config/initializers/recaptcha.rb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
Recaptcha.configure do |config|
|
||||
config.public_key = '6LcliyUTAAAAAIOCkg-c4f4btSEiDJIdwVVixnd2'
|
||||
config.private_key = '6LcliyUTAAAAAHEtx8ow3tkKx4-fQ5gTbvKN82B5'
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue