I want to have the login form and registration form on the same page but have problem with validation?

I use this https://drupal.org/node/350634 to create custom user-login.tpl.php file where
I've got all the control I need for customizing login page.

The problem comes when I try to put there the registration form.

When the two forms are on the same page the username fields (e-mail also) are both required and when I submit the login form for example it shows the message username and e-mail are required and does not process the form.

Is it possible to make this to work?

Currently I'm trying to render the user_registration_from from within user-login.tpl.php file.