Snippet: Template logic to display user session switching html form

About

If a user is logged in, display their name + logout button, if not, than display a login form.

Submited via irc by Lukasz Serwatka

{let thisuser=fetch('user','current_user')}
{section show=$thisuser.is_logged_in}
<p>Welcome. You are logged in as {$thisuser.contentobject.name}</p>
<p><a href="/user/logout">Logout</a></p>
{section-else}
<!-- login form goes here -->
{/section}
{/let}