|
@@ -0,0 +1,38 @@
|
|
|
+diff --git a/src/Controller/LoginEmailUsernameUserAuthenticationController.php b/src/Controller/LoginEmailUsernameUserAuthenticationController.php
|
|
|
+index 7c3ac4f..0e6f04e 100644
|
|
|
+--- a/src/Controller/LoginEmailUsernameUserAuthenticationController.php
|
|
|
++++ b/src/Controller/LoginEmailUsernameUserAuthenticationController.php
|
|
|
+@@ -47,7 +47,11 @@ class LoginEmailUsernameUserAuthenticationController extends UserAuthenticationC
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($uid = $this->userAuth->authenticate($credentials['name'], $credentials['pass'])) {
|
|
|
+- $this->flood->clear('user.http_login', $this->getLoginFloodIdentifier($request, $credentials['name']));
|
|
|
++ if (property_exists($this, 'userFloodControl')) {
|
|
|
++ $this->userFloodControl->clear('user.http_login', $this->getLoginFloodIdentifier($request, $credentials['name']));
|
|
|
++ } else {
|
|
|
++ $this->flood->clear('user.http_login', $this->getLoginFloodIdentifier($request, $credentials['name']));
|
|
|
++ }
|
|
|
+ /** @var \Drupal\user\UserInterface $user */
|
|
|
+ $user = $this->userStorage->load($uid);
|
|
|
+ $this->userLoginFinalize($user);
|
|
|
+@@ -78,10 +82,18 @@ class LoginEmailUsernameUserAuthenticationController extends UserAuthenticationC
|
|
|
+
|
|
|
+ $flood_config = $this->config('user.flood');
|
|
|
+ if ($identifier = $this->getLoginFloodIdentifier($request, $credentials['name'])) {
|
|
|
+- $this->flood->register('user.http_login', $flood_config->get('user_window'), $identifier);
|
|
|
++ if (property_exists($this, 'userFloodControl')) {
|
|
|
++ $this->userFloodControl->register('user.http_login', $flood_config->get('user_window'), $identifier);
|
|
|
++ } else {
|
|
|
++ $this->flood->register('user.http_login', $flood_config->get('user_window'), $identifier);
|
|
|
++ }
|
|
|
+ }
|
|
|
+ // Always register an IP-based failed login event.
|
|
|
+- $this->flood->register('user.failed_login_ip', $flood_config->get('ip_window'));
|
|
|
++ if (property_exists($this, 'userFloodControl')) {
|
|
|
++ $this->userFloodControl->register('user.failed_login_ip', $flood_config->get('ip_window'));
|
|
|
++ } else {
|
|
|
++ $this->flood->register('user.failed_login_ip', $flood_config->get('ip_window'));
|
|
|
++ }
|
|
|
+ throw new BadRequestHttpException('Sorry, unrecognized username or password.');
|
|
|
+ }
|
|
|
+
|