summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/openid/openid.module2
-rw-r--r--modules/user/user.module22
2 files changed, 6 insertions, 18 deletions
diff --git a/modules/openid/openid.module b/modules/openid/openid.module
index 69c981922..3e456f2b9 100644
--- a/modules/openid/openid.module
+++ b/modules/openid/openid.module
@@ -403,7 +403,6 @@ function openid_authentication($response) {
$form_state['values']['pass'] = user_password();
$form_state['values']['status'] = variable_get('user_register', 1) == 1;
$form_state['values']['response'] = $response;
- $form_state['values']['auth_openid'] = $identity;
$form = drupal_retrieve_form('user_register', $form_state);
drupal_prepare_form('user_register', $form, $form_state);
drupal_validate_form('user_register', $form, $form_state);
@@ -425,6 +424,7 @@ function openid_authentication($response) {
drupal_set_message(t("Error saving user account."), 'error');
drupal_goto();
}
+ user_set_authmaps($account, array("authname_openid" => $identity));
user_external_login($account);
}
drupal_redirect_form($form, $form_state['redirect']);
diff --git a/modules/user/user.module b/modules/user/user.module
index f5d9d9bdd..0effc2601 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -230,10 +230,9 @@ function user_save($account, $array = array(), $category = 'account') {
$array['access'] = time();
}
foreach ($array as $key => $value) {
- // Fields that don't pertain to the users, users_roles, or
- // authmap tables are automatically serialized into the
- // users.data column. Authmap fields always begin with 'auth'.
- if ($key != 'roles' && substr($key, 0, 4) !== 'auth' && empty($user_fields[$key])) {
+ // Fields that don't pertain to the users or user_roles
+ // automatically serialized into the users.data column.
+ if ($key != 'roles' && empty($user_fields[$key])) {
if ($value === NULL) {
unset($data[$key]);
}
@@ -314,7 +313,7 @@ function user_save($account, $array = array(), $category = 'account') {
// fields from being saved there.
$data = array();
foreach ($array as $key => $value) {
- if ((substr($key, 0, 4) !== 'auth') && ($key != 'roles') && (empty($user_fields[$key])) && ($value !== NULL)) {
+ if (($key != 'roles') && (empty($user_fields[$key])) && ($value !== NULL)) {
$data[$key] = $value;
}
}
@@ -337,17 +336,6 @@ function user_save($account, $array = array(), $category = 'account') {
$user = user_load(array('uid' => $array['uid']));
}
- // Save distributed authentication mappings.
- $authmaps = array();
- foreach ($array as $key => $value) {
- if (substr($key, 0, 4) == 'auth') {
- $authmaps[$key] = $value;
- }
- }
- if (sizeof($authmaps) > 0) {
- user_set_authmaps($user, $authmaps);
- }
-
return $user;
}
@@ -1349,7 +1337,6 @@ function user_external_login_register($name, $module) {
'pass' => user_password(),
'init' => $name,
'status' => 1,
- "authname_$module" => $name,
'access' => time()
);
$account = user_save('', $userinfo);
@@ -1358,6 +1345,7 @@ function user_external_login_register($name, $module) {
drupal_set_message(t("Error saving user account."), 'error');
return;
}
+ user_set_authmaps($account, array("authname_$module" => $name));
$user = $account;
watchdog('user', 'New external user: %name using module %module.', array('%name' => $name, '%module' => $module), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $user->uid .'/edit'));
}