feat(support#create): block with invisible captcha [avoid painful captcha]

This commit is contained in:
Martin 2021-12-29 14:00:47 +01:00
parent ec6c71beea
commit 252eee272b
9 changed files with 87 additions and 42 deletions

View file

@ -1,4 +1,6 @@
class SupportController < ApplicationController
invisible_captcha only: [:create], on_spam: :redirect_to_root
def index
setup_context
end
@ -92,4 +94,8 @@ class SupportController < ApplicationController
def email
current_user&.email || params[:email]
end
def redirect_to_root
redirect_to root_path, alert: t('invisible_captcha.custom_message')
end
end

View file

@ -25,6 +25,9 @@
= label_tag :type do
= t('.your_question')
= hidden_field_tag :type, params[:type]
= invisible_captcha
%dl
- @options.each do |(question, question_type, link)|
%dt