Commit 689e832e authored by Andrew Belcher's avatar Andrew Belcher Committed by Jakob P
Browse files

Issue #2959854 by vakulrai, rlmumford, elachlan, andrewbelcher, tanmayk: Remove dependency on node

parent a937ba62
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -4,6 +4,3 @@ description: Provides the CAPTCHA API for adding challenges to arbitrary forms.
package: Spam control
core_version_requirement: ^8.8 || ^9
configure: captcha_settings

dependencies:
  - drupal:node
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ function captcha_requirements($phase) {
 */
function captcha_install() {

  if (!\Drupal::service('config.installer')->isSyncing()) {
  if (!\Drupal::service('config.installer')->isSyncing() && \Drupal::moduleHandler()->moduleExists('node')) {
    $form_ids = [];
    // Add form_ids of all currently known node types too.
    foreach (node_type_get_names() as $type => $name) {
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ function captcha_help($route_name, RouteMatchInterface $route_match) {
      $output .= '<p>' . t('"CAPTCHA" is an acronym for "Completely Automated Public Turing test to tell Computers and Humans Apart". It is typically a challenge-response test to determine whether the user is human. The CAPTCHA module is a tool to fight automated submission by malicious users (spamming) of for example comments forms, user registration forms, guestbook forms, etc. You can extend the desired forms with an additional challenge, which should be easy for a human to solve correctly, but hard enough to keep automated scripts and spam bots out.') . '</p>';
      $output .= '<p>' . t('Note that the CAPTCHA module interacts with page caching (see <a href=":performancesettings">performance settings</a>). Because the challenge should be unique for each generated form, the caching of the page it appears on is prevented. Make sure that these forms do not appear on too many pages or you will lose much caching efficiency. For example, if you put a CAPTCHA on the user login block, which typically appears on each page for anonymous visitors, caching will practically be disabled. The comment submission forms are another example. In this case you should set the <em>Location of comment submission form</em> to <em>Display on separate page</em> in the comment settings of the relevant <a href=":contenttypes">content types</a> for better caching efficiency.', [
        ':performancesettings' => Url::fromRoute('system.performance_settings')->toString(),
        ':contenttypes' => Url::fromRoute('entity.node_type.collection')->toString(),
        ':contenttypes' => \Drupal::moduleHandler()->moduleExists('node') ? Url::fromRoute('entity.node_type.collection')->toString() : '#',
      ]) . '</p>';
      $output .= '<p>' . t('CAPTCHA is a trademark of Carnegie Mellon University.') . '</p>';
      return ['#markup' => $output];
+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ abstract class CaptchaWebTestBase extends BrowserTestBase {
   *
   * @var array
   */
  public static $modules = ['captcha', 'comment'];
  public static $modules = ['captcha', 'comment', 'node'];

  /**
   * {@inheritdoc}