diff --git a/core/modules/rest/config/install/rest.settings.yml b/core/modules/rest/config/install/rest.settings.yml index f0200da..0a44346 100644 --- a/core/modules/rest/config/install/rest.settings.yml +++ b/core/modules/rest/config/install/rest.settings.yml @@ -44,8 +44,3 @@ resources: # # The full documentation is located at # https://drupal.org/documentation/modules/rest - -flood: - login_cookie: - limit: 2 - interval: 3600 diff --git a/core/modules/rest/src/Plugin/rest/resource/UserLoginResource.php b/core/modules/rest/src/Plugin/rest/resource/UserLoginResource.php index 4a17552..be8aa64 100644 --- a/core/modules/rest/src/Plugin/rest/resource/UserLoginResource.php +++ b/core/modules/rest/src/Plugin/rest/resource/UserLoginResource.php @@ -76,7 +76,7 @@ protected function userLogin(array $credentials = array()) { user_login_finalize($user); return new ResourceResponse('You are logged in as ' . $credentials['name'], 200, array()); } - \Drupal::flood()->register('rest', \Drupal::config('rest.settings')->get('flood.login_cookie.interval')); + \Drupal::flood()->register('rest.login_cookie', \Drupal::config('user.flood')->get('user_window')); return new ResourceResponse('Sorry, unrecognized username or password.', 400, array()); } @@ -97,9 +97,9 @@ protected function userLogout() { * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException */ protected function restLoginCookieFloodControl() { - $limit = \Drupal::config('rest.settings')->get('flood.login_cookie.limit'); - $interval = \Drupal::config('rest.settings')->get('flood.login_cookie.interval'); - if (!\Drupal::flood()->isAllowed('rest', $limit, $interval)) { + $limit = \Drupal::config('user.flood')->get('user_limit'); + $interval = \Drupal::config('user.flood')->get('user_window'); + if (!\Drupal::flood()->isAllowed('rest.login_cookie', $limit, $interval)) { return TRUE; } return FALSE;