Commit 43837162 authored by Bryan Manalo's avatar Bryan Manalo
Browse files

Issue #3293027 by mjgruta: Use core path matcher.

parent d598ece9
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@
        "source": "http://cgit.drupalcode.org/reauthenticate"
    },
    "require": {
        "php": ">=7.4",
        "rkr/wildcards": "^1.0.3"
        "php": ">=7.4"
    }
}
+3 −3
Original line number Diff line number Diff line
@@ -3,9 +3,7 @@
namespace Drupal\reauthenticate\EventSubscriber;

use Drupal\Core\Url;
use Drupal\user\Entity\User;
use Drupal\user\UserInterface;
use Kir\StringUtils\Matching\Wildcards\Pattern;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
@@ -100,8 +98,10 @@ class ReauthenticateSubscriber implements EventSubscriberInterface {
    $config = \Drupal::config('reauthenticate.settings');
    $paths = $config->get('paths');
    $paths = preg_split('/[\s]+/', $paths);

    $path_matcher = \Drupal::service('path.matcher');
    foreach ($paths as $path) {
      if (Pattern::create($path)->match($path_alias)) {
      if ($path_matcher->matchPath($path_alias, $path)) {
        $match = TRUE;
        break;
      }
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ class ReauthenticateSettingsForm extends ConfigFormBase {
      '#type' => 'textarea',
      '#title' => $this->t('Pages for reauthentication'),
      '#resizable' => TRUE,
      '#description' => $this->t("Specify per line the pages that would require authentication. Wildcard is allowed like '/user/*/edit'."),
      '#description' => $this->t("Specify per line the pages that would require authentication. Wildcard is allowed like '/user/*/edit*'."),
      '#default_value' => $config->get('paths'),
    ];