function recaptcha_v3_admin_settings_validate in reCAPTCHA v3 7
Validation function for recaptcha_v3_admin_settings().
See also
File
- ./
recaptcha_v3.admin.inc, line 172 - Provides the Google No CAPTCHA administration settings.
Code
function recaptcha_v3_admin_settings_validate($form, &$form_state) {
$new_action = $form_state['values']['actions_settings']['new'];
if (!empty($new_action['action'])) {
if (!preg_match('/^([0-9a-zA-Z\\/_]+)$/', $new_action['action'])) {
form_set_error('actions_settings][new][action', t('Action may only contain alphanumeric characters, underscores and forward slashes.'));
}
if (empty($new_action['id'])) {
form_set_error('actions_settings][new][id', t('Action machine name is required.'));
}
elseif ($new_action['id'] === 'default') {
form_set_error('actions_settings][new][id', t("You can't use string \"default\" as action id. This id reserved by captcha module."));
}
}
if (!empty($form_state['values']['actions_settings']['overview'])) {
$form_actions = $form_state['values']['actions_settings']['overview'];
foreach ($form_actions as $id => $form_action) {
if (!preg_match('/^([0-9a-zA-Z\\/_]+)$/', $form_action['action'])) {
form_set_error('actions_settings][overview][' . $id . '][action', t('Action may only contain alphanumeric characters, underscores and forward slashes.'));
}
}
}
}