Recaptcha support added when reporting screenshots

There's lots of spam recently. We need to do something against it.
This commit is contained in:
Christoph Haas 2016-07-21 11:29:25 +02:00
parent 85b9f1014f
commit ff0b93380a
5 changed files with 16 additions and 4 deletions

View file

@ -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

View file

@ -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'