Yep! It’s possible. Here’s the code I use:
<id="login">
<?php
global $user_ID, $user_identity;
get_currentuserinfo();
if (!$user_ID):
?>
<form name="loginform" id="loginform" action="<?php echo get_settings('siteurl'); ?>/wp-login.php" method="post">
<div><label><?php _e('Username') ?>:<input type="text" name="log" id="log" value="" size="15" tabindex="7" /></label><br />
<label><?php _e('Password') ?>: <input type="password" name="pwd" id="pwd" value="" size="15" tabindex="8" /></label>
<input type="submit" name="Login" value="<?php _e('Login'); ?> »" tabindex="9" />
<?php wp_register('', ' <i>Registration is FREE and gives you the ability to post comments.</i>'); ?>
<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/></div>
</form>
<?php
else:
?>
<ul>
<?php wp_register(); ?>
<li><a href="<?php echo get_settings('siteurl') . '/wp-login.php?action=logout&redirect_to=' . $_SERVER['REQUEST_URI']; ?>"><?php _e('Logout'); ?></a></li>
</ul>
<?php
endif;
?>
</li>