/**
 * Low level function to reset a given user's password. 
 * 
 * This can only be called from execute_new_password_request().
 * 
 * @param int $user_guid The user.
 * @param string $password password text (which will then be converted into a hash and stored)
 */
function force_user_password_reset($user_guid, $password)
{
    global $CONFIG;
    if (call_gatekeeper('execute_new_password_request', __FILE__)) {
        $user = get_entity($user_guid);
        if ($user) {
            $salt = generate_random_cleartext_password();
            // Reset the salt
            $user->salt = $salt;
            $hash = generate_user_password($user, $password);
            return update_data("UPDATE {$CONFIG->dbprefix}users_entity set password='******', salt='{$salt}' where guid={$user_guid}");
        }
    }
    return false;
}
Esempio n. 2
0
 * river_comments
 *
 * @author Pedro Prez
 * @link http://community.elgg.org/pg/profile/pedroprez
 * @copyright (c) Keetup 2010
 * @link http://www.keetup.com/
 * @license GNU General Public License (GPL) version 2
 */
// Get the Elgg engine
$callback = get_input('callback');
$entity_guid = get_input('guid');
if ($callback && !elgg_is_logged_in()) {
    echo 'loginerror';
    exit;
} else {
    call_gatekeeper();
}
$entity = get_entity($entity_guid);
if (!$entity) {
    forward($_SERVER['HTTP_REFERER']);
}
$title = "";
if ($entity instanceof ElggUser || $entity instanceof ElggGroup) {
    $title = $entity->name;
} else {
    if ($entity instanceof ElggObject && $entity->getSubtype() == 'thewire') {
        $title = $entity->description;
    } else {
        $title = $entity->title;
    }
}