If I were you, I would use the wp_login_form function to create your form, but it looks like you got everything right, and maybe you have a good reason to use a manual form.
<?php wp_login_form(); ?>
Either way, you can use this action to update the login redirect, add it to functions.php:
add_action( 'login_redirect', 'custom_redirect_login', 10, 3 );
function custom_redirect_login( $redirect_to, $request, $user )
{
$posts = get_pages( array(
'authors' => $user->ID
) );
if (! empty($posts) )
{
// Since the pages are listed in DESC order, the first one is the most
// recently created.
return get_permalink($posts[0]->ID);
}
else
{
// If no posts associated with the user, use default.
return $redirect_to;
}
}
As noted, if you need to redirect to a post or custom_post_type instead of a page, you will need to use a non-page-specific method, so this might be better since it will work more universally:
function custom_redirect_login( $redirect_to, $request, $user )
{
$posts = new WP_Query( array( 'author' => $user->ID ) );
if ($posts->have_posts())
{
// Since the pages are listed in DESC order, the first one is the most
// recently created.
return get_permalink($posts->posts[0]->ID);
}
else
{
// If no posts associated with the user, use default.
return $redirect_to;
}
}