Yes it saves the temporary password over the USER_PASSWORD in the USERS table
But did not update the array $user['USER_PASSWORD']=$user['USER_TEMPORARY_PASSWORD'];
before making the $autolog

Can you check again, I may still be wrong