writing form action path programmatically
The action is stored in the form's #action property, so assuming your form is represented by the $elements variable in the template, something like this should do it:

&lt;form accept-charset="UTF-8" id="user-login-form" method="post" action="&lt;?php echo $elements['#action']; ?&gt;"&gt;