Fix CAPTCHA page not following design pattern of sign-up flow (#25395)
This commit is contained in:
parent
3b5e302f7f
commit
39110d1d0a
4 changed files with 16 additions and 6 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
module CaptchaConcern
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
include Hcaptcha::Adapters::ViewMethods
|
||||
|
||||
included do
|
||||
|
@ -35,18 +36,22 @@ module CaptchaConcern
|
|||
flash.delete(:hcaptcha_error)
|
||||
yield message
|
||||
end
|
||||
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def extend_csp_for_captcha!
|
||||
policy = request.content_security_policy
|
||||
|
||||
return unless captcha_required? && policy.present?
|
||||
|
||||
%w(script_src frame_src style_src connect_src).each do |directive|
|
||||
values = policy.send(directive)
|
||||
|
||||
values << 'https://hcaptcha.com' unless values.include?('https://hcaptcha.com') || values.include?('https:')
|
||||
values << 'https://*.hcaptcha.com' unless values.include?('https://*.hcaptcha.com') || values.include?('https:')
|
||||
|
||||
policy.send(directive, *values)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1048,7 +1048,9 @@ code {
|
|||
}
|
||||
|
||||
.simple_form .h-captcha {
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.permissions-list {
|
||||
|
|
|
@ -7,10 +7,12 @@
|
|||
= hidden_field_tag :confirmation_token, params[:confirmation_token]
|
||||
= hidden_field_tag :redirect_to_app, params[:redirect_to_app]
|
||||
|
||||
%h1.title= t('auth.captcha_confirmation.title')
|
||||
%p.lead= t('auth.captcha_confirmation.hint_html')
|
||||
|
||||
.field-group
|
||||
= render_captcha
|
||||
= render_captcha
|
||||
|
||||
%p.lead= t('auth.captcha_confirmation.help_html', email: mail_to(Setting.site_contact_email, nil))
|
||||
|
||||
.actions
|
||||
%button.button= t('challenge.confirm')
|
||||
= button_tag t('challenge.confirm'), class: 'button', type: :submit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue