Login and Register page is rendering twice

Whenever I fill username and password in my login page I am again
redirected to the login page.However the url of the page changes to http://localhost:3000/login?username=Harshit&password=harshit
where Harshit and harshit is the login username and password
respectively.The username and password in the input fields though remain
unpopulated.If I enter the username and password again then I am
allowed to enter the webapp.The same thing happens with the register
page.I am not able to register in the first attempt.

Also the jquery validation rules that are set do not show any effect
the first time I enter the fields to login and register page.However
they come into effect the second time I enter the fields in login and
register page.

Here is the HTML code for login page:

<template name="login">
    <div class="login-form">
        <form class="login">
            <p>Username: <input type="text" name="username" id='usernameL' placeholder='Username' required></p>
            <p>Password: <input type="password" name="password" id='passwordL' placeholder='password' required></p>
            <p><button type="submit" class="btn btn-primary">Let me in</button></p>
            <p>Don't have an account</p>
            <h3><a href='{{pathFor route="home"}}'>Register</a></h3>

The home page is the register page.
Here is the js code :

Template.login.onRendered(function() {
        submitHandler: function(event) {

            var username = document.getElementById('usernameL').value;
            var password = document.getElementById('passwordL').value;
            Meteor.loginWithPassword(username, password, function(error) {
                if (error) {
                } else {

The code for routerjs:

Router.route('/login', {