Commit a96bfa29 authored by Julian Pustkuchen's avatar Julian Pustkuchen
Browse files

Issue #1534462 by prudloff, GaëlG, Anybody, awolfey: Riddler kills page cache...

Issue #1534462 by prudloff, GaëlG, Anybody, awolfey: Riddler kills page cache even if there's only one cachable question
parent 50721e91
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -45,14 +45,16 @@ function riddler_captcha($op, $captcha_type = '', $captcha_sid = NULL) {
          '#required' => TRUE,
          '#size' => 15,
          '#attributes' => ['autocomplete' => 'off'],
          '#cache' => ['max-age' => 0],
        ];
        // If there are several random questions, we cannot cache.
        if (count($riddles) > 1) {
          $result['form']['captcha_response']['#cache'] = ['max-age' => 0];
          \Drupal::service('page_cache_kill_switch')->trigger();
        }

        // Use custom validation so multiple answers can be tested.
        $result['captcha_validate'] = 'riddler_captcha_validate';

        \Drupal::service('page_cache_kill_switch')->trigger();

        return $result;
      }
      break;