aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2013-04-19 20:00:47 -0400
committercash <cash.costello@gmail.com>2013-04-19 20:00:47 -0400
commitaa409144fcac454c8f6e2566606e0fb206d933d7 (patch)
tree728ba618a06205fa94368868b4fd5330e07f7f8d
parentd39b04a835556ed84f8f6fc8367321b36209bbbd (diff)
downloadelgg-aa409144fcac454c8f6e2566606e0fb206d933d7.tar.gz
elgg-aa409144fcac454c8f6e2566606e0fb206d933d7.tar.bz2
Fixes #5233 password reset uses entity save so memcache is cleared
-rw-r--r--engine/lib/users.php16
1 files changed, 8 insertions, 8 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 868cd7815..9a5194896 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -705,18 +705,18 @@ function send_new_password_request($user_guid) {
* @return bool
*/
function force_user_password_reset($user_guid, $password) {
- global $CONFIG;
-
$user = get_entity($user_guid);
if ($user instanceof ElggUser) {
- $salt = generate_random_cleartext_password(); // Reset the salt
- $user->salt = $salt;
+ $ia = elgg_set_ignore_access();
- $hash = generate_user_password($user, $password);
+ $user->salt = generate_random_cleartext_password();
+ $hash = generate_user_password($user, $password);
+ $user->password = $hash;
+ $result = (bool)$user->save();
- $query = "UPDATE {$CONFIG->dbprefix}users_entity
- set password='$hash', salt='$salt' where guid=$user_guid";
- return update_data($query);
+ elgg_set_ignore_access($ia);
+
+ return $result;
}
return false;