diff --git a/templates/home.html b/templates/home.html index 850dd2fc0cd3b8347398c658b67eedf246a47791..b423cf6ceafaea479871482edd15fb0bdfe3b868 100644 --- a/templates/home.html +++ b/templates/home.html @@ -3,12 +3,14 @@ <head> <link href="{{ url_for('static', filename='style.css') }}" rel="stylesheet"> <title>URL shorter</title> - <script src="https://www.google.com/recaptcha/api.js" async defer></script> - <script> - function onSubmit(token) { - document.getElementById("form").submit(); - } - </script> + {% if recaptchaPrivateKey %} + <script src="https://www.google.com/recaptcha/api.js" async defer></script> + <script> + function onSubmit(token) { + document.getElementById("form").submit(); + } + </script> + {% endif %} </head> <body> @@ -17,12 +19,21 @@ {% if not short_url %} <form method="post" id= "form" class="login-form" action=""> <input id="url" name="url" type="url" placeholder="long url" value="{{long_url_prefilled}}"/> + {% if showDomainSelect %} Domain: <select name="domain" id="domain"> {{domain | safe}} </select> <br><p> </p> + {% else %} + <input type="hidden" name="domain" id="domain" value={{domain}}> + {% endif %} <input id="short" name="short" type="text" placeholder="short name" value="{{short_url_prefilled}}"/> + + {% if recaptchaPrivateKey %} <button class="g-recaptcha" data-sitekey="{{recaptchaPublicKey}}" data-callback='onSubmit'>short</button> + {% else %} + <button>short</button> + {% endif %} </form> {% else %} <h3>Your shortened URL is: <a href="http://{{short_url}}"> {{short_url}}</a></h3>