Commit 75bf3398 authored by Julian Pustkuchen's avatar Julian Pustkuchen
Browse files

Issue #3321861 by Grevil, Anybody: Change image_captcha submodule and test modules location

parent b9042317
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -176,6 +176,9 @@ function _captcha_required_for_user($captcha_sid, $form_id) {
 */
function _captcha_get_title() {
  $title = \Drupal::config('captcha.settings')->get('title');
  if ($title === NULL) {
    return '';
  }
  return Xss::filter($title);
}

@@ -187,6 +190,9 @@ function _captcha_get_title() {
 */
function _captcha_get_description() {
  $description = \Drupal::config('captcha.settings')->get('description');
  if ($description === NULL) {
    return '';
  }
  return Xss::filter($description);
}

+22 −0
Original line number Diff line number Diff line
@@ -58,3 +58,25 @@ function image_captcha_update_8001() {
  }
  $config->save(TRUE);
}

/**
 * Fix possibly broken image_captcha fonts path after 8.x-1.7 update.
 */
function image_captcha_update_9001(&$sandbox) {
  // Reset the font path from the correct module directory location:
  $config = \Drupal::configFactory()->getEditable('image_captcha.settings');
  $module_path = \Drupal::service('extension.list.module')->getPath('image_captcha');
  $config->set('image_captcha_fonts', [
    hash('sha256', $module_path . '/fonts/Tesox/tesox.ttf'),
    hash('sha256', $module_path . '/fonts/Tuffy/Tuffy.ttf'),
  ])->save(TRUE);
}

/**
 * Set captcha 'title' default, as the setting did not exist before.
 */
function image_captcha_update_9002(&$sandbox) {
  // Reset the font path from the correct module directory location:
  $config = \Drupal::configFactory()->getEditable('image_captcha.settings');
  $config->set('title', 'CAPTCHA')->save(TRUE);
}