Can we move this logic to a separate template (login.html?) so that index.html looks cleaner.