Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
!composer.json
!composer.lock
!composer.patches.json
!patches.lock.json
!symfony.lock
!load.environment.php

Expand Down
179 changes: 0 additions & 179 deletions PATCHES/user_expire-customize-notification-email.patch

This file was deleted.

51 changes: 0 additions & 51 deletions PATCHES/user_expire-reset-expiration-on-reactivation.patch

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,20 +1,46 @@
diff --git a/username_enumeration_prevention.module b/username_enumeration_prevention.module
index 1038f75b1d823887965f79df9d3b76fc396031a1..075abaa22c8392f810093e066990934328fdd01c 100644
--- a/username_enumeration_prevention.module
+++ b/username_enumeration_prevention.module
@@ -86,3 +86,15 @@ function username_enumeration_prevention_pass_submit($form, FormStateInterface $
\Drupal::messenger()->addMessage(t('If the username or email address exists and is active, further instructions have been sent to your email address.'));
$form_state->setRedirect('user.page');
}
diff --git a/src/Hook/UsernameEnumerationPreventionHooks.php b/src/Hook/UsernameEnumerationPreventionHooks.php
new file mode 100644
index 0000000..25fbf14
--- /dev/null
+++ b/src/Hook/UsernameEnumerationPreventionHooks.php
@@ -0,0 +1,40 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Drupal\username_enumeration_prevention\Hook;
+
+use Drupal\Core\Asset\AttachedAssetsInterface;
+use Drupal\Core\Hook\Attribute\Hook;
+use Drupal\Core\Hook\Order\Order;
+use Drupal\Core\Routing\CurrentRouteMatch;
+use Symfony\Component\DependencyInjection\Attribute\Autowire;
+
+/**
+ * Implements hook_js_settings_alter().
+ *
+ * Remove drupalSettings.path.currentPath on 404 responses.
+ * Hook implementations for username_enumeration_prevention.
+ */
+function username_enumeration_prevention_js_settings_alter(&$settings) {
+ if (\Drupal::routeMatch()->getRouteName() === "system.404" ) {
+ $settings['path']['currentPath'] = '';
+readonly class UsernameEnumerationPreventionHooks {
+
+ /**
+ * The UsernameEnumerationPreventionHooks constructor.
+ *
+ * @param \Drupal\Core\Routing\CurrentRouteMatch $routeMatch
+ * The route match.
+ */
+ public function __construct(
+ #[Autowire('@current_route_match')]
+ private CurrentRouteMatch $routeMatch,
+ ) {
+ }
+
+ /**
+ * Implements hook_js_settings_alter().
+ */
+ #[Hook('js_settings_alter', order: Order::Last)]
+ public function jsSettingsAlter(array &$settings, AttachedAssetsInterface $assets): void {
+ if ($this->routeMatch->getRouteName() === 'system.404') {
+ $settings['path']['currentPath'] = '';
+ }
+ }
+}
+
+}
15 changes: 8 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"php": ">=8.3",
"ext-gd": "*",
"composer/installers": "^2",
"cweagans/composer-patches": "^1.7",
"cweagans/composer-patches": "^2.0",
"drupal/admin_denied": "^2.0",
"drupal/amazon_ses": "^3.0",
"drupal/components": "^3.0@beta",
Expand Down Expand Up @@ -55,7 +55,7 @@
"drupal/xmlsitemap": "^2.0.0-beta1",
"drush/drush": "^13",
"oomphinc/composer-installers-extender": "^2.0",
"orakili/composer-drupal-info-file-patch-helper": "^1",
"orakili/composer-drupal-info-file-patch-helper": "^2",
"unocha/common_design": "^9",
"unocha/gtm_barebones": "^1.1",
"unocha/ocha_monitoring": "^1.0"
Expand Down Expand Up @@ -108,11 +108,12 @@
}
},
"extra": {
"enable-patching": true,
"composer-exit-on-patch-failure": true,
"patches-file": "composer.patches.json",
"patchLevel": {
"drupal/core": "-p2"
"composer-patches": {
"patches-file": "composer.patches.json",
"exit-on-patch-failure": true,
"package-depths": {
"drupal/core": 2
}
},
"installer-types": [
"bower-asset",
Expand Down
Loading