Skip to content

Commit

Permalink
Setting tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Croker committed Apr 2, 2021
1 parent 475c8b8 commit 21f6404
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
6 changes: 3 additions & 3 deletions src/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@
// The template to use if Snaptcha identifies a submission as spam.
//'errorTemplate' => '',

// The minimum time for form submission in seconds (increase this to harden spam blocking).
//'minimumSubmitTime' => 1,

// The expiration time for form submissions in minutes.
//'expirationTime' => 60,

// The minimum time for form submission in seconds (increase this to harden spam blocking).
//'minimumSubmitTime' => 3,

// The controller actions to exclude from validation.
//'excludeControllerActions' => [],

Expand Down
4 changes: 2 additions & 2 deletions src/models/SettingsModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ class SettingsModel extends Model
/**
* @var int
*/
public $expirationTime = 60;
public $minimumSubmitTime = 1;

/**
* @var int
*/
public $minimumSubmitTime = 1;
public $expirationTime = 60;

/**
* @var array|string
Expand Down
26 changes: 11 additions & 15 deletions src/templates/_settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

{{ forms.lightswitchField({
first: true,
required: true,
label: 'Validation Enabled'|t('snaptcha'),
name: 'validationEnabled',
instructions: 'Whether form submissions should be validated. Ensure that all of your forms that submit via POST requests have the necessary tags in place before enabling this.'|t('snaptcha'),
Expand All @@ -21,7 +20,6 @@
}) }}

{{ forms.lightswitchField({
required: true,
label: 'Validate Users'|t('snaptcha'),
name: 'validateUsers',
instructions: 'Whether form submissions should be validated for logged-in users (recommended if public user registration is enabled).'|t('snaptcha'),
Expand All @@ -31,7 +29,6 @@
}) }}

{{ forms.lightswitchField({
required: true,
label: 'One Time Key'|t('snaptcha'),
name: 'oneTimeKey',
instructions: 'Whether form submissions should be limited to one time per page refresh (recommended for low to medium traffic sites).'|t('snaptcha'),
Expand All @@ -41,7 +38,6 @@
}) }}

{{ forms.lightswitchField({
required: true,
label: 'Log Rejected'|t('snaptcha'),
name: 'logRejected',
instructions: 'Whether rejected form submissions should be logged (log will be written to `{log}`).'|t('snaptcha', {log: alias('@storage/logs/snaptcha.log')}),
Expand Down Expand Up @@ -112,17 +108,6 @@
errors: settings.getErrors('errorTemplate')
}) }}

{{ forms.textField({
type: 'number',
required: true,
label: 'Expiration Time'|t('snaptcha'),
name: 'expirationTime',
instructions: 'The expiration time for form submissions in minutes.'|t('snaptcha'),
warning: (config.expirationTime is defined ? configWarning('expirationTime')),
value: settings.expirationTime,
errors: settings.getErrors('expirationTime'),
}) }}

{{ forms.textField({
type: 'number',
required: true,
Expand All @@ -134,6 +119,17 @@
errors: settings.getErrors('minimumSubmitTime'),
}) }}

{{ forms.textField({
type: 'number',
required: true,
label: 'Expiration Time'|t('snaptcha'),
name: 'expirationTime',
instructions: 'The expiration time for form submissions in minutes.'|t('snaptcha'),
warning: (config.expirationTime is defined ? configWarning('expirationTime')),
value: settings.expirationTime,
errors: settings.getErrors('expirationTime'),
}) }}

{{ hiddenInput('excludeControllerActions', '') }}
{{ forms.editableTableField({
label: 'Exclude Controller Actions'|t('snaptcha'),
Expand Down

0 comments on commit 21f6404

Please sign in to comment.