# This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. Index: contributions/modules/login_security/login_security.module --- contributions/modules/login_security/login_security.module Base (1.9.2.3) +++ contributions/modules/login_security/login_security.module Locally Modified (Based On 1.9.2.3) @@ -99,6 +99,23 @@ case 'user_login_block': // Attach a new validatdor for the name field $form['name']['#validate']['login_security_validate'] = array(); + // Change to do soft-blocking here, see issue: http://drupal.org/node/493164 + // We alter the form here, and still show the message in the validation + $variables = _login_security_get_variables_by_name(check_plain($form['name']['#value'])); + //drupal_set_message("
".print_r($form,1)."
"); + // Check for host login attempts: Soft + if ($variables['%soft_block_attempts'] >= 1) { + if ($variables['%ip_current_count'] >= $variables['%soft_block_attempts']) { + //Alter current form, so user will not be able to submit it + // this loop is instead of doing t() because t() can only translate static strings, not variables. + foreach ($variables as $key => $value) { + $variables[$key] = theme('placeholder', $value); + } + form_set_error('submit', strtr(variable_get('login_security_host_soft_banned', LOGIN_SECURITY_HOST_SOFT_BANNED), $variables)); + unset($form['submit']); + } + } + break; case 'user_admin_settings': if (user_access('administer users')) { @@ -294,14 +311,6 @@ } } - // Check for host login attempts: Soft - if ($variables['%soft_block_attempts'] >= 1) { - if ($variables['%ip_current_count'] > $variables['%soft_block_attempts']) { - form_set_error('submit', t(variable_get('login_security_host_soft_banned', LOGIN_SECURITY_HOST_SOFT_BANNED), $variables)); - drupal_goto(drupal_get_destination()); - } - } - // Check for user login attempts if ($variables['%user_block_attempts'] >= 1) { if ($variables['%user_current_count'] > $variables['%user_block_attempts']) {