diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-05 16:48:24 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-05 16:48:24 +0000 |
commit | 43e89eedf4faff3ee13973caebc2714736d5b362 (patch) | |
tree | 2c1bd0fc3c395b310d34b4dd83e1615bd23a4382 /engine/lib | |
parent | ca03d831fc65cd4ca669de7785dd3fff30bd33f1 (diff) | |
download | elgg-43e89eedf4faff3ee13973caebc2714736d5b362.tar.gz elgg-43e89eedf4faff3ee13973caebc2714736d5b362.tar.bz2 |
using setPrivateSetting() and getPrivateSetting() instead of procedural functions
git-svn-id: http://code.elgg.org/elgg/trunk@8031 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/users.php | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php index 84e5fcc7b..567f587ea 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -685,8 +685,8 @@ function send_new_password_request($user_guid) { if ($user) { // generate code $code = generate_random_cleartext_password(); - //create_metadata($user_guid, 'conf_code', $code, '', 0, ACCESS_PRIVATE); - set_private_setting($user_guid, 'passwd_conf_code', $code); + $user->setPrivateSetting('passwd_conf_code', $code); + // generate link $link = $CONFIG->site->url . "pg/resetpassword?u=$user_guid&c=$code"; @@ -744,18 +744,20 @@ function execute_new_password_request($user_guid, $conf_code) { $user_guid = (int)$user_guid; $user = get_entity($user_guid); - $saved_code = get_private_setting($user_guid, 'passwd_conf_code'); + if ($user) { + $saved_code = $user->getPrivateSetting('passwd_conf_code'); - if ($user && $saved_code && $saved_code == $conf_code) { - $password = generate_random_cleartext_password(); + if ($saved_code && $saved_code == $conf_code) { + $password = generate_random_cleartext_password(); - if (force_user_password_reset($user_guid, $password)) { - remove_private_setting($user_guid, 'passwd_conf_code'); + if (force_user_password_reset($user_guid, $password)) { + remove_private_setting($user_guid, 'passwd_conf_code'); - $email = elgg_echo('email:resetpassword:body', array($user->name, $password)); + $email = elgg_echo('email:resetpassword:body', array($user->name, $password)); - return notify_user($user->guid, $CONFIG->site->guid, - elgg_echo('email:resetpassword:subject'), $email, NULL, 'email'); + return notify_user($user->guid, $CONFIG->site->guid, + elgg_echo('email:resetpassword:subject'), $email, NULL, 'email'); + } } } |