Index: modules/openid/openid.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/openid/openid.module,v
retrieving revision 1.71
diff -u -9 -p -r1.71 openid.module
--- modules/openid/openid.module	31 Jan 2010 18:39:46 -0000	1.71
+++ modules/openid/openid.module	8 Feb 2010 16:10:16 -0000
@@ -431,19 +431,20 @@ function openid_association($op_endpoint
 function openid_authentication($response) {
   module_load_include('inc', 'openid');
 
   $identity = $response['openid.claimed_id'];
 
   $account = user_external_load($identity);
   if (isset($account->uid)) {
     if (!variable_get('user_email_verification', TRUE) || $account->login) {
       // Check if user is blocked.
-      user_login_name_validate(array(), $state, (array)$account);
+      $state['values']['name'] = $account->name;
+      user_login_name_validate(array(), $state);
       if (!form_get_errors()) {
         // Load global $user and perform final login tasks.
         $form_state['uid'] = $account->uid;
         user_login_submit(array(), $form_state);
         // Let other modules act on OpenID login
         module_invoke_all('openid_response', $response, $account);
       }
     }
     else {
Index: modules/openid/openid.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/openid/openid.test,v
retrieving revision 1.12
diff -u -9 -p -r1.12 openid.test
--- modules/openid/openid.test	31 Jan 2010 18:39:46 -0000	1.12
+++ modules/openid/openid.test	8 Feb 2010 16:10:16 -0000
@@ -125,18 +125,54 @@ class OpenIDFunctionalTest extends Drupa
     // Delete the newly added identity.
     $this->clickLink(t('Delete'));
     $this->drupalPost(NULL, array(), t('Confirm'));
 
     $this->assertText(t('OpenID deleted.'), t('Identity deleted'));
     $this->assertNoText($identity, t('Identity no longer appears in list.'));
   }
 
   /**
+   * Test that a blocked user cannot log in.
+   */
+  function testBlockedUserLogin() {
+    // Use a User-supplied Identity that is the URL of an XRDS document.
+    $identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));
+
+    // Log in and add an OpenID Identity to the account.
+    $this->drupalLogin($this->web_user);
+    $this->addIdentity($identity);
+    $this->drupalLogout();
+
+    // Log in as an admin user and block the account.
+    $admin_user = $this->drupalCreateUser(array('administer users'));
+    $this->drupalLogin($admin_user);
+    $this->drupalGet('admin/people');
+    $edit = array(
+      'operation' => 'block',
+      'accounts[' . $this->web_user->uid . ']' => TRUE,
+    );
+    $this->drupalPost('admin/people', $edit, t('Update'));
+    $this->assertRaw('The update has been performed.', t('Account was blocked.'));
+    $this->drupalLogout();
+
+    // Fill out and submit the login form.
+    $edit = array('openid_identifier' => $identity);
+    $this->drupalPost(NULL, $edit, t('Log in'));
+
+    // Check we are on the OpenID redirect form.
+    $this->assertTitle(t('OpenID redirect'), t('OpenID redirect page was displayed.'));
+
+    // Submit form to the OpenID Provider Endpoint.
+    $this->drupalPost(NULL, array(), t('Send'));
+    $this->assertRaw(t('The username %name has not been activated or is blocked.', array('%name' => $this->web_user->name)), t('User login was blocked.'));
+  }
+
+  /**
    * Add OpenID identity to user's profile.
    *
    * @param $identity
    *   The User-supplied Identifier.
    * @param $version
    *   The protocol version used by the service.
    * @param $claimed_id
    *   The expected Claimed Identifier returned by the OpenID Provider.
    */
