Index: login_security.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/login_security/Attic/login_security.admin.inc,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 login_security.admin.inc
--- login_security.admin.inc	26 Mar 2010 13:40:50 -0000	1.1.2.5
+++ login_security.admin.inc	17 Sep 2010 22:52:59 -0000
@@ -111,17 +111,20 @@
     '#description' => t('Checking this option, when a user does success in login, a message will remember him when was the last site access with this account.'),
     '#default_value' => variable_get('login_security_last_access_timestamp', 0)
   );
-  $form['login_messages']['login_security_user_blocked_email'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Send email message to the admin (uid 1) when a user is blocked by this module.'),
-    '#default_value' => variable_get('login_security_user_blocked_email', LOGIN_SECURITY_USER_BLOCKED_EMAIL),
-  );
-  $form['login_messages']['login_security_login_activity_email'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Send email message to the admin (uid 1) when an ongoing attack is detected.'),
-    '#default_value' => variable_get('login_security_login_activity_email', LOGIN_SECURITY_LOGIN_ACTIVITY_EMAIL),
+  $form['login_messages']['login_security_user_blocked_email_user'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Select who should get an email message when a user is blocked by this module'),
+    '#default_value' => variable_get('login_security_user_blocked_email_user', LOGIN_SECURITY_USER_BLOCKED_EMAIL_USER),
+    '#autocomplete_path' => 'user/autocomplete',
+    '#element_validate' => array('_login_security_valid_user'),
+  );
+  $form['login_messages']['login_security_login_activity_email_user'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Select who should get an email message when an ongoing attack is detected'),
+    '#default_value' => variable_get('login_security_login_activity_email_user', LOGIN_SECURITY_LOGIN_ACTIVITY_EMAIL_USER),
+    '#autocomplete_path' => 'user/autocomplete',
+    '#element_validate' => array('_login_security_valid_user'),
   );
-
 
   $form['login_security']['Notifications'] = array(
     '#type' => 'fieldset',
@@ -162,7 +165,7 @@
 
   $form['login_security']['Notifications']['user_block_email'] = array(
     '#type' => 'fieldset',
-    '#title' => t('Email to be sent to the administrator user (uid 1) for blocked accounts.'),
+    '#title' => t('Email to be sent to the defined user for blocked accounts.'),
     '#weight' => 3,
     '#description' => t('Configure the subject and body of the email message.'),
   );
@@ -180,7 +183,7 @@
 
   $form['login_security']['Notifications']['login_activity_email'] = array(
     '#type' => 'fieldset',
-    '#title' => t('Email to be sent to the administrator user (uid 1) for ongoing attack detections.'),
+    '#title' => t('Email to be sent to the defined user for ongoing attack detections.'),
     '#weight' => 3,
     '#description' => t('Configure the subject and body of the email message.'),
   );
@@ -217,6 +220,18 @@
 }
 
 /*
+ * Verify that element is a valid username
+ */
+function _login_security_valid_user($element, &$form_state) {
+  if ($element['#value'] !== '') {
+    $count = db_result(db_query("SELECT COUNT(*) FROM {users} WHERE name = '%s'", $element['#value']));
+    if (intval($count) != 1) {
+      form_error($element, t('The !field field should be a valid username.', array('!field' => $element['#title'])));
+    }
+  }
+}
+
+/*
  * Clean login_security_track table
  */
 function _login_security_clean_tracked_events($form, &$form_state) {
Index: login_security.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/login_security/login_security.install,v
retrieving revision 1.6.2.9
diff -u -r1.6.2.9 login_security.install
--- login_security.install	3 Oct 2009 10:16:33 -0000	1.6.2.9
+++ login_security.install	17 Sep 2010 22:52:56 -0000
@@ -55,6 +55,10 @@
  */
 function login_security_install() {
   drupal_install_schema('login_security');
+  $admin_name = db_result(db_query('SELECT name FROM {users} WHERE uid = 1'));
+  // Adjust the email notification variables for user uid 1 by default.
+  variable_set('login_security_user_blocked_email_user', $admin_name);
+  variable_set('login_security_login_activity_email_user', $admin_name);
 }
 
 /**
@@ -72,19 +76,47 @@
   variable_del('login_security_host_soft_banned');
   variable_del('login_security_host_hard_banned');
   variable_del('login_security_user_blocked');
-  variable_del('login_security_user_blocked_email');
+  variable_del('login_security_user_blocked_email_user');
   variable_del('login_security_user_blocked_email_subject');
   variable_del('login_security_user_blocked_email_body');
   variable_del('login_security_delay_increase');
   variable_del('login_security_last_login_timestamp');
   variable_del('login_security_last_access_timestamp');
   variable_del('login_security_activity_threshold');
-  variable_del('login_security_activity_email');
+  variable_del('login_security_activity_email_user');
   variable_del('login_security_activity_subject');
   variable_del('login_security_activity_body');
   variable_del('login_security_threshold_notified');
   drupal_uninstall_schema('login_security');
 }
+/**
+ * Variable clean up update as for #866068
+ * http://drupal.org/node/866068
+ *
+ * Allows to change email recipient
+ *
+ * @return array
+ */
+function login_security_update_6002() {
+  $ret = array();
+  $admin_name = db_result(db_query('SELECT name FROM {users} WHERE uid = 1'));
+  // Adjust the 'blocked user' email notification variables
+  $blocked_email = variable_get('login_security_user_blocked_email', LOGIN_SECURITY_USER_BLOCKED_EMAIL);
+  $blocked_email_user = variable_get('login_security_user_blocked_email_user', LOGIN_SECURITY_USER_BLOCKED_EMAIL_USER);
+  if ($blocked_email && $blocked_email_user === '') {
+    variable_set('login_security_user_blocked_email_user', $admin_name);
+  }
+  // Adjust the 'suspect activity' email notification variables
+  $activity_email = variable_get('login_security_login_activity_email', LOGIN_SECURITY_LOGIN_ACTIVITY_EMAIL);
+  $activity_email_user = variable_get('login_security_login_activity_email_user', LOGIN_SECURITY_LOGIN_ACTIVITY_EMAIL_USER);
+  if ($activity_email && $activity_email_user === '') {
+    variable_set('login_security_login_activity_email_user', $admin_name);
+  }
+  // Clean up the now obsolete boolean variables
+  variable_del('login_security_user_blocked_email');
+  variable_del('login_security_login_activity_email');
+  return $ret;
+}
 
 /**
  * Support IPv6 length addresses in 6.x because the original 6.x
Index: login_security.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/login_security/login_security.module,v
retrieving revision 1.12.2.23
diff -u -r1.12.2.23 login_security.module
--- login_security.module	26 Mar 2010 13:17:04 -0000	1.12.2.23
+++ login_security.module	17 Sep 2010 22:36:18 -0000
@@ -23,10 +23,10 @@
 define('LOGIN_SECURITY_HOST_SOFT_BANNED', t("This host is not allowed to log in to %site. Please contact your site administrator."));
 define('LOGIN_SECURITY_HOST_HARD_BANNED', t("The IP address <em>%ip</em> is banned at %site, and will not be able to access any of its content from now on. Please contact the site administrator."));
 define('LOGIN_SECURITY_USER_BLOCKED', t("The user <em>%username</em> has been blocked due to failed login attempts."));
-define('LOGIN_SECURITY_USER_BLOCKED_EMAIL', FALSE);
+define('LOGIN_SECURITY_USER_BLOCKED_EMAIL_USER', '');
 define('LOGIN_SECURITY_USER_BLOCKED_EMAIL_SUBJECT', t("Security action: The user %username has been blocked."));
 define('LOGIN_SECURITY_USER_BLOCKED_EMAIL_BODY', t("The user %username (%edit_uri) has been blocked at %site due to the amount of failed login attempts. Please check the logs for more information."));
-define('LOGIN_SECURITY_LOGIN_ACTIVITY_EMAIL', FALSE);
+define('LOGIN_SECURITY_LOGIN_ACTIVITY_EMAIL_USER', '');
 define('LOGIN_SECURITY_LOGIN_ACTIVITY_EMAIL_SUBJECT', t("Security information: Unexpected login activity has been detected at %site."));
 define('LOGIN_SECURITY_LOGIN_ACTIVITY_EMAIL_BODY', t("The configured threshold of %activity_threshold logins has been reached with a tota of %tracking_current_count invalid login attempts. You should review your log information about login attempts at %site."));
 define('LOGIN_SECURITY_THRESHOLD_NOTIFIED', FALSE);
@@ -164,9 +164,10 @@
         watchdog('login_security', 'Ongoing attack detected: Suspicious activity detected in login form submissions. Too many invalid login attempts threshold reached: currently %tracking_current_count events are tracked, and threshold is configured for %activity_threshold attempts.', $variables, WATCHDOG_WARNING);
         variable_set('login_security_threshold_notified', TRUE);
         //Submit email only if required..
-        if (variable_get('login_security_login_activity_email', LOGIN_SECURITY_LOGIN_ACTIVITY_EMAIL)) {
+        $login_activity_email_user = variable_get('login_security_login_activity_email_user', LOGIN_SECURITY_LOGIN_ACTIVITY_EMAIL_USER);
+        if ($login_activity_email_user !== '') {
           $from = variable_get('site_mail', ini_get('sendmail_from'));
-          $admin_mail =  db_result(db_query("SELECT mail FROM {users} WHERE uid = 1"));
+          $admin_mail =  db_result(db_query("SELECT mail FROM {users} WHERE name = '%s'", $login_activity_email_user));
           $subject = login_security_t(variable_get('login_security_login_activity_email_subject', LOGIN_SECURITY_LOGIN_ACTIVITY_EMAIL_SUBJECT), $variables);
           $body = login_security_t(variable_get('login_security_login_activity_email_body', LOGIN_SECURITY_LOGIN_ACTIVITY_EMAIL_BODY), $variables);
           $mail = drupal_mail('login_security', 'login_activity_notify', $admin_mail, language_default(), $variables, $from, TRUE);
@@ -335,9 +336,10 @@
       form_set_error('void', login_security_t(variable_get('login_security_user_blocked', LOGIN_SECURITY_USER_BLOCKED), $variables));
 
       // Send admin email
-      if (variable_get('login_security_user_blocked_email', LOGIN_SECURITY_USER_BLOCKED_EMAIL)) {
+      $user_blocked_email_user = variable_get('login_security_user_blocked_email_user', LOGIN_SECURITY_USER_BLOCKED_EMAIL_USER);
+      if ($user_blocked_email_user !== '') {
         $from = variable_get('site_mail', ini_get('sendmail_from'));
-        $admin_mail =  db_result(db_query("SELECT mail FROM {users} WHERE uid = 1"));
+        $admin_mail =  db_result(db_query("SELECT mail FROM {users} WHERE name = '%s'", $user_blocked_email_user));
         $subject = login_security_t(variable_get('login_security_user_blocked_email_subject', LOGIN_SECURITY_USER_BLOCKED_EMAIL_SUBJECT), $variables);
         $body = login_security_t(variable_get('login_security_user_blocked_email_body', LOGIN_SECURITY_USER_BLOCKED_EMAIL_BODY), $variables);
         return drupal_mail('login_security', 'block_user_notify', $admin_mail, language_default(), $variables, $from, TRUE);
Index: login_security.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/login_security/login_security.test,v
retrieving revision 1.1.2.12
diff -u -r1.1.2.12 login_security.test
--- login_security.test	19 Dec 2009 12:05:19 -0000	1.1.2.12
+++ login_security.test	17 Sep 2010 22:37:36 -0000
@@ -39,12 +39,12 @@
     $this->assertField('login_security_host_soft_banned', t('Soft banned message field exists.'));
     $this->assertField('login_security_host_hard_banned', t('Hard banned message field exists.'));
     $this->assertField('login_security_user_blocked', t('User blocked message field exists.'));
-    $this->assertField('login_security_user_blocked_email', t('User blocked email toggle field exists.'));
+    $this->assertField('login_security_user_blocked_email_user', t('User blocked email notification user field exists.'));
     $this->assertField('login_security_user_blocked_email_subject', t('User blocked email subject field exists.'));
     $this->assertField('login_security_user_blocked_email_body', t('User blocked email body field exists'));
     $this->assertField('login_security_last_login_timestamp', t('Last login timestamp field exists.'));
     $this->assertField('login_security_last_access_timestamp', t('Last access timestamp field exists.'));
-    $this->assertField('login_security_login_activity_email', t('Send email for unexpected login activity field exists.'));
+    $this->assertField('login_security_login_activity_email_user', t('Login activity email notification user field exists.'));
     $this->assertField('login_security_login_activity_email_subject', t('Login activity email subject field exists.'));
     $this->assertField('login_security_login_activity_email_body', t('Login activity email body field exists.'));
     $this->assertField('login_security_activity_threshold', t('Invalid login threshold field exists.'));
@@ -85,7 +85,7 @@
 
     // in Drupal 7, we can drupalGetMails() to see if a notice went out to admin
     // in the meantime, turn the message off just in case it doesn't get caught properly yet
-    variable_set('login_security_user_blocked_email', 0);
+    variable_set('login_security_user_blocked_email_user', '');
 
     $normal_user = $this->drupalCreateUser(array('access content'));
 

