Index: modules/openid/openid.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/openid/openid.inc,v retrieving revision 1.1 diff -u -F^f -r1.1 openid.inc --- modules/openid/openid.inc 18 Jun 2007 16:09:39 -0000 1.1 +++ modules/openid/openid.inc 20 Jun 2007 21:08:58 -0000 @@ -368,7 +368,7 @@ function _openid_get_bytes($num_bytes) { if (!isset($f)) { $f = @fopen(OPENID_RAND_SOURCE, "r"); } - if (!isset($f)) { + if (!$f) { // pseudorandom used $bytes = ''; for ($i = 0; $i < $num_bytes; $i += 4) { Index: modules/openid/openid.module =================================================================== RCS file: /cvs/drupal/drupal/modules/openid/openid.module,v retrieving revision 1.1 diff -u -F^f -r1.1 openid.module --- modules/openid/openid.module 18 Jun 2007 16:09:39 -0000 1.1 +++ modules/openid/openid.module 20 Jun 2007 21:08:58 -0000 @@ -108,7 +108,7 @@ function openid_login_validate($form, &$ $return_to = url('', array('absolute' => TRUE)); } - openid_begin($form_state['values']['openid_url'], $return_to); + openid_begin($form_state['values']['openid_url'], $return_to, $form_state['values']); } /** @@ -191,7 +191,7 @@ function openid_user_delete($account, $a * @param $claimed_id The OpenID to authenticate * @param $return_to The endpoint to return to from the OpenID Provider */ -function openid_begin($claimed_id, $return_to = '') { +function openid_begin($claimed_id, $return_to = '', $form_values = array()) { include_once drupal_get_path('module', 'openid') .'/openid.inc'; $claimed_id = _openid_normalize($claimed_id); @@ -207,6 +207,9 @@ function openid_begin($claimed_id, $retu $_SESSION['openid_op_endpoint'] = $op_endpoint; // Store the claimed_id in the session (for handling delegation). $_SESSION['openid_claimed_id'] = $claimed_id; + // Store the login form values so we can pass them to + // user_exteral_login later. + $_SESSION['openid_user_login_values'] = $form_values; // If bcmath is present, then create an association $assoc_handle = ''; @@ -398,7 +401,7 @@ function openid_authentication($response $account = user_external_load($identity); if (isset($account->uid)) { if (!variable_get('user_email_verification', TRUE) || $account->login) { - user_external_login($account); + user_external_login($account, $_SESSION['openid_user_login_values']); } else { drupal_set_message(t('You must validate your email address for this account before logging in via OpenID')); Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.799 diff -u -F^f -r1.799 user.module --- modules/user/user.module 17 Jun 2007 11:59:05 -0000 1.799 +++ modules/user/user.module 20 Jun 2007 21:08:58 -0000 @@ -71,22 +71,28 @@ function user_external_load($authname) { } /** -* Perform standard Drupal login operations for a user object. The -* user object must already be authenticated. This function verifies -* that the user account is not blocked/denied and then performs the login, -* updates the login timestamp in the database, invokes hook_user('login'), -* regenerates the session, etc. -* -* @param $account -* An authenticated user object to be set as the currently logged -* in user. -* @return boolean -* TRUE if the login succeeds, FALSE otherwise. -*/ -function user_external_login($account) { + * Perform standard Drupal login operations for a user object. The + * user object must already be authenticated. This function verifies + * that the user account is not blocked/denied and then performs the login, + * updates the login timestamp in the database, invokes hook_user('login'), + * regenerates the session, etc. + * + * @param $account + * An authenticated user object to be set as the currently logged + * in user. + * @param $edit + * The array of form values submitted by the user, if any. + * @return boolean + * TRUE if the login succeeds, FALSE otherwise. + */ +function user_external_login($account, $edit = array()) { $form = drupal_get_form('user_login'); - $state = array(); + $state['values'] = $edit; + if (empty($state['values']['name'])) { + $state['values']['name'] = $account->name; + } + user_login_name_validate($form, $state, (array)$account); if (form_get_errors()) { return FALSE; @@ -1086,7 +1092,7 @@ function user_login_default_validators() * * @return void **/ - function user_login_name_validate($form, &$form_state) { +function user_login_name_validate($form, &$form_state) { if (isset($form_state['values']['name'])) { if (user_is_blocked($form_state['values']['name'])) { // blocked in user administration