Skip to content

Commit

Permalink
Added ways of configurating captcha fields in widget
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoJokhan committed Sep 1, 2023
1 parent 5207a6d commit dd86c28
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/cms/lib/modules/resource-form-widgets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ module.exports = {
{
name: 'submitting',
label: 'Submitting',
fields: ['buttonTextSubmit', 'buttonTextSave', 'buttonTextConcept', 'useCaptcha']
fields: ['buttonTextSubmit', 'buttonTextSave', 'buttonTextConcept', 'useCaptcha', 'captchaTitle', 'captchaMessage', 'captchaRefreshText']
},
{
name: 'agreed',
Expand Down
15 changes: 15 additions & 0 deletions packages/cms/lib/modules/resource-form-widgets/lib/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,21 @@ const fields = [
],
def: true
},
{
name: 'captchaTitle',
type: 'string',
label: 'Title above the captcha',
},
{
name: 'captchaMessage',
type: 'string',
label: 'Instruction text for the captcha',
},
{
name: 'captchaRefreshText',
type: 'string',
label: 'Refresh text',
},
{
name: 'buttonTextConcept',
type: 'string',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
<div id="captcha">
<h2>{{ data.widget.labelCaptcha if data.widget.labelCaptcha else 'Captcha' }}</h2>
<h2>{{ data.widget.captchaTitle if data.widget.captchaTitle else 'Captcha' }}</h2>
<div class="form-info" style="height: auto;"> <div class="form-field">

<img loading="lazy" src="{{data.siteUrl}}/modules/openstad-captcha/captcha" class="captcha-img" width="200" />
<br />
<a href="#" class="captcha-refresh">
<small class="underline">
refresh
{% if data.widget.captchaRefreshText %}
{{data.widget.captchaRefreshText}}
{% else %}
refresh
{% endif %}
</small>
</a>
<br />
<label>
{% if data.widget.captchaLabel %}
{{data.widget.captchaLabel}}
{% if data.widget.captchaMessage %}
{{data.widget.captchaMessage}}
{% else %}
{{ __('Please enter the words you see into the field below ') }}
{% endif %}
Expand Down

1 comment on commit dd86c28

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Published new image: openstad/frontend:feature-add-captcha-to-resource-form-if-set-to-everyone-dd86c28

Please sign in to comment.