diff --git a/text_captcha/modules/lost_character_captcha/lost_character_captcha.info.yml b/text_captcha/modules/lost_character_captcha/lost_character_captcha.info.yml index 8419fee..05376c4 100755 --- a/text_captcha/modules/lost_character_captcha/lost_character_captcha.info.yml +++ b/text_captcha/modules/lost_character_captcha/lost_character_captcha.info.yml @@ -2,13 +2,7 @@ name: Lost Character CAPTCHA type: module description: Provides CAPTCHA that asks for the lost character(s) in a given word. package: "Spam control" +core: "8.x" dependencies: - - captcha:captcha - captcha_pack:text_captcha -configure: admin/config/people/captcha/lost_character_captcha - -# Information added by drupal.org packaging script on 2011-10-23 -#version: "8.x-1.0-alpha1" -core: "8.x" -#project: "captcha_pack" -datestamp: "1319362529" +configure: lost_character_captcha.settings diff --git a/text_captcha/modules/phrase_captcha/phrase_captcha.info.yml b/text_captcha/modules/phrase_captcha/phrase_captcha.info.yml index 34126ac..bd0dfed 100755 --- a/text_captcha/modules/phrase_captcha/phrase_captcha.info.yml +++ b/text_captcha/modules/phrase_captcha/phrase_captcha.info.yml @@ -2,12 +2,7 @@ name: Phrase CAPTCHA type: module description: Provides CAPTCHA that requires to pick for the right word/character out of a CAPTCHA phrase. package: "Spam control" -dependencies: - - captcha:captcha -configure: admin/config/people/captcha/phrase_captcha - -# Information added by drupal.org packaging script on 2011-10-23 -# version: "8.x-1.0-alpha1" core: "8.x" -# project: "captcha_pack" -datestamp: "1319362529" +dependencies: + - captcha_pack:text_captcha +configure: phrase_captcha.settings diff --git a/text_captcha/modules/phrase_captcha/src/Form/PhraseCaptchaSettingsForm.php b/text_captcha/modules/phrase_captcha/src/Form/PhraseCaptchaSettingsForm.php index 0c62fca..fa853e3 100755 --- a/text_captcha/modules/phrase_captcha/src/Form/PhraseCaptchaSettingsForm.php +++ b/text_captcha/modules/phrase_captcha/src/Form/PhraseCaptchaSettingsForm.php @@ -86,9 +86,26 @@ class PhraseCaptchaSettingsForm extends ConfigFormBase { /** * {@inheritdoc} */ + public function validateForm(array &$form, FormStateInterface $form_state) { + if ($form_state->getValue('phrase_captcha_words') == PHRASE_CAPTCHA_USER_DEFINED_WORDS) { + $word_count_minimum = $form_state->getValue('phrase_captcha_word_quantity') + $form_state->getValue('phrase_captcha_additional_word_quantity') + 2; + _text_captcha_word_pool_validate('phrase_captcha_userdefined_word_pool', $form_state, $word_count_minimum, NULL, NULL); + } + // Check word selection. + if (count(array_filter($form_state->getValue('phrase_captcha_word_selection_challenges'))) < 1) { + $form_state->setErrorByName('phrase_captcha_word_selection_challenges', $this->t('You need to select at least one word selection criterium')); + } + + parent::validateForm($form, $form_state); + } + + /** + * {@inheritdoc} + */ public function submitForm(array &$form, FormStateInterface $form_state) { $config = $this->config('phrase_captcha.settings'); $config + ->set('phrase_captcha_words', $form_state->getValue('phrase_captcha_words')) ->set('phrase_captcha_word_selection_challenges', $form_state->getValue('phrase_captcha_word_selection_challenges')) ->set('phrase_captcha_additional_word_quantity', $form_state->getValue('phrase_captcha_additional_word_quantity')) ->set('phrase_captcha_word_quantity', $form_state->getValue('phrase_captcha_word_quantity')); @@ -102,20 +119,4 @@ class PhraseCaptchaSettingsForm extends ConfigFormBase { parent::SubmitForm($form, $form_state); } - /** - * {@inheritdoc} - */ - public function validateForm(array &$form, FormStateInterface $form_state) { - if ($form_state->getValue('phrase_captcha_words') == PHRASE_CAPTCHA_USER_DEFINED_WORDS) { - $word_count_minimum = $form_state->getValue('phrase_captcha_word_quantity') + $form_state->getValue('phrase_captcha_additional_word_quantity') + 2; - _text_captcha_word_pool_validate('phrase_captcha_userdefined_word_pool', $form_state, $word_count_minimum, NULL, NULL); - } - // Check word selection. - if (count(array_filter($form_state->getValue('phrase_captcha_word_selection_challenges'))) < 1) { - $form_state->setErrorByName('phrase_captcha_word_selection_challenges', $this->t('You need to select at least one word selection criterium')); - } - - parent::validateForm($form, $form_state); - } - } diff --git a/text_captcha/modules/word_list_captcha/word_list_captcha.info.yml b/text_captcha/modules/word_list_captcha/word_list_captcha.info.yml index de86ce6..c8cb8f2 100755 --- a/text_captcha/modules/word_list_captcha/word_list_captcha.info.yml +++ b/text_captcha/modules/word_list_captcha/word_list_captcha.info.yml @@ -2,12 +2,7 @@ name: Word List CAPTCHA type: module description: Provides CAPTCHA like 'which word does not belong in the list [green red bird blue]?'. package: "Spam control" +core: "8.x" dependencies: - - captcha:captcha - captcha_pack:text_captcha -configure: admin/config/people/captcha/word_list_captcha -# Information added by drupal.org packaging script on 2011-10-23 -# version: "8.x-1.0-alpha1" -core: "8.x" -# project: "captcha_pack" -datestamp: "1319362529" +configure: word_list_captcha.settings diff --git a/text_captcha/modules/word_list_captcha/word_list_captcha.module b/text_captcha/modules/word_list_captcha/word_list_captcha.module index dec70d6..242ed1d 100755 --- a/text_captcha/modules/word_list_captcha/word_list_captcha.module +++ b/text_captcha/modules/word_list_captcha/word_list_captcha.module @@ -64,17 +64,6 @@ function word_list_captcha_captcha($op, $captcha_type = '') { '#options' => $options, // Extra class needed for additional CSS'ing of the options. '#attributes' => ['class' => ['text-captcha-word-list-radios']], - // TODO: the following needs to be ported to Drupal 6, which does not - // Support DANGEROUS_SKIP_CHECK anymore - // - // The following entry '#DANGEROUS_SKIP_CHECK' is needed to prevent - // that Drupal checks during validation phase if a submitted option - // is in the list of possible options. (see includes/form.inc) - // The options are randomly generated on each call and consequently - // almost never the same during the generate phase and the validation - // phase. - // - '#DANGEROUS_SKIP_CHECK' => TRUE, '#required' => TRUE, '#cache' => ['max-age' => 0], ]; diff --git a/text_captcha/text_captcha.libraries.yml b/text_captcha/text_captcha.libraries.yml index 0033401..f4bb5ae 100755 --- a/text_captcha/text_captcha.libraries.yml +++ b/text_captcha/text_captcha.libraries.yml @@ -1,4 +1,4 @@ base: css: - all: + theme: css/text_captcha.css: {}