Password Gets Reset when executing user_save I have a function that sets a user to confirmed after they login to my site for the first time. However, whenever I run this function and I log out and try to log back in the password doesn't work anymore and I have to do a manual reset in the database. I can't seem to find what would cause a change in the password. Any advice?

Note that I am using mongodb.

function update_profile($uid,$attribute_name,$attribute_value,$arrayaction=NULL)
{
    // update some user property
    $existing = user_load($uid);
    $edit = (array) $existing;

    //Update profile iformation
    if(!empty($arrayaction))
    {
        if(strtolower($arrayaction) == 'push')
        {
            array_push($edit[$attribute_name]['und'][0],$attribute_value);
        }
        else if (strtolower($arrayaction) == 'unset')
        {
            if(($key = array_search($attribute_value, $edit[$attribute_name]['und'][0])) !== false) {
               unset($edit[$attribute_name]['und'][0][$key]);
            }
        }
    }
    else
    {
        $edit[$attribute_name]['und'][0] = $attribute_value;
    }

    //Make the changes to the user
    user_save($existing, $edit);
}

function module_user_login(&amp;$edit,$account) {
    if ($account-&gt;access == 0) {
        update_profile($account-&gt;uid,'field_confirmed',array('value'=&gt;1),NULL);
    }
}
Be sure to

unset($edit['pass']);


if you don't want to edit password. Generally creating $edit from $existing shouldn't be needed. You do not need to re-save all fields, you only put into $edit what you know you want to change. You should, usually, be able to start with empty array, without seeding it first.