Put password on a wordpress link in a article

I think this is almost what the article Add Private Content to Posts via Shortcode talks about. But it’s only for registered users:

add_shortcode('private', 'private_content');
function private_content($atts, $content = null) {
    if ( is_user_logged_in() )
        return '<div class="private-content">' . $content . '</div>';
    return '';
}

And used inside the post/page like:

[private]
This post contains registered-only content!
[/private]

To add a password functionality, you’d have to add a <form> inside the shortcode function and show the content after the password is successfully $_POSTed.
Maybe it’s more straight forward using Ajax.