summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-08-05 20:41:57 +0000
committerDries Buytaert <dries@buytaert.net>2004-08-05 20:41:57 +0000
commit35cad55e5b2b151306e82cce647c0cb3a2d70166 (patch)
tree6e17b34eeb764602d3373ece9a4c45ad148a11ad
parentf971b768f611c896b9c58b34284bf0bec2c04767 (diff)
downloadbrdo-35cad55e5b2b151306e82cce647c0cb3a2d70166.tar.gz
brdo-35cad55e5b2b151306e82cce647c0cb3a2d70166.tar.bz2
- Patch #8523 by killes: avoid profile data being deleted when requesting a new
password.
-rw-r--r--modules/user.module6
-rw-r--r--modules/user/user.module6
2 files changed, 6 insertions, 6 deletions
diff --git a/modules/user.module b/modules/user.module
index 351f09a61..832059081 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -883,11 +883,11 @@ function user_pass($edit = array()) {
global $base_url;
if ($edit['name']) {
- $account = db_fetch_object(db_query("SELECT uid, name, mail FROM {users} WHERE status = 1 AND LOWER(name) = '%s'", strtolower($edit['name'])));
+ $account = user_load(array('name' => $edit['name'], 'status' => 1));
if (!$account) form_set_error('name', t('Sorry. The username "<i>%s</i>" is not recognized.', array('%s' => $edit['name'])));
}
else if ($edit['mail']) {
- $account = db_fetch_object(db_query("SELECT uid, name, mail FROM {users} WHERE status = 1 AND LOWER(mail) = '%s'", strtolower($edit['mail'])));
+ $account = user_load(array('mail' => $edit['mail'], 'status' => 1));
if (!$account) form_set_error('name', t('Sorry. The e-mail address "<i>%s</i>" is not recognized.', array('%s' => $edit['mail'])));
}
if ($account) {
@@ -896,7 +896,7 @@ function user_pass($edit = array()) {
$pass = user_password();
// Save new password:
- user_save($account, array('pass' => $pass));
+ user_save($account, array_merge(object2array($account), array('pass' => $pass)));
// Mail new password:
$variables = array('%username' => $account->name, '%site' => variable_get('site_name', 'drupal'), '%password' => $pass, '%uri' => $base_url, '%uri_brief' => substr($base_url, strlen('http://')), '%mailto' => $account->mail, '%date' => format_date(time()), '%login_uri' => url('user/login', NULL, NULL, TRUE), '%edit_uri' => url('user/edit', NULL, NULL, TRUE));
diff --git a/modules/user/user.module b/modules/user/user.module
index 351f09a61..832059081 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -883,11 +883,11 @@ function user_pass($edit = array()) {
global $base_url;
if ($edit['name']) {
- $account = db_fetch_object(db_query("SELECT uid, name, mail FROM {users} WHERE status = 1 AND LOWER(name) = '%s'", strtolower($edit['name'])));
+ $account = user_load(array('name' => $edit['name'], 'status' => 1));
if (!$account) form_set_error('name', t('Sorry. The username "<i>%s</i>" is not recognized.', array('%s' => $edit['name'])));
}
else if ($edit['mail']) {
- $account = db_fetch_object(db_query("SELECT uid, name, mail FROM {users} WHERE status = 1 AND LOWER(mail) = '%s'", strtolower($edit['mail'])));
+ $account = user_load(array('mail' => $edit['mail'], 'status' => 1));
if (!$account) form_set_error('name', t('Sorry. The e-mail address "<i>%s</i>" is not recognized.', array('%s' => $edit['mail'])));
}
if ($account) {
@@ -896,7 +896,7 @@ function user_pass($edit = array()) {
$pass = user_password();
// Save new password:
- user_save($account, array('pass' => $pass));
+ user_save($account, array_merge(object2array($account), array('pass' => $pass)));
// Mail new password:
$variables = array('%username' => $account->name, '%site' => variable_get('site_name', 'drupal'), '%password' => $pass, '%uri' => $base_url, '%uri_brief' => substr($base_url, strlen('http://')), '%mailto' => $account->mail, '%date' => format_date(time()), '%login_uri' => url('user/login', NULL, NULL, TRUE), '%edit_uri' => url('user/edit', NULL, NULL, TRUE));