aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/faucet/faucet.html
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-04-17 00:49:40 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-04-17 00:49:40 +0800
commit03dffe3efdde4fd0d849b9523249d0ad42037dce (patch)
tree09317940b0bd8e8e846463bb31052754eb27c007 /cmd/faucet/faucet.html
parentcb3f5f8b932156df9078085e77bef493eca1581b (diff)
downloadgo-tangerine-03dffe3efdde4fd0d849b9523249d0ad42037dce.tar.gz
go-tangerine-03dffe3efdde4fd0d849b9523249d0ad42037dce.tar.zst
go-tangerine-03dffe3efdde4fd0d849b9523249d0ad42037dce.zip
cmd/faucet: add optional recaptcha validation support
Diffstat (limited to 'cmd/faucet/faucet.html')
-rw-r--r--cmd/faucet/faucet.html13
1 files changed, 8 insertions, 5 deletions
diff --git a/cmd/faucet/faucet.html b/cmd/faucet/faucet.html
index 570145ea2..39fcf77fe 100644
--- a/cmd/faucet/faucet.html
+++ b/cmd/faucet/faucet.html
@@ -51,9 +51,10 @@
<div class="input-group">
<input id="gist" type="text" class="form-control" placeholder="GitHub Gist URL containing your Ethereum address...">
<span class="input-group-btn">
- <button class="btn btn-default" type="button" onclick="submit()">Give me Ether!</button>
+ <button class="btn btn-default" type="button" onclick="{{if .Recaptcha}}grecaptcha.execute(){{else}}submit(){{end}}">Give me Ether!</button>
</span>
- </div>
+ </div>{{if .Recaptcha}}
+ <div class="g-recaptcha" data-sitekey="{{.Recaptcha}}" data-callback="submit" data-size="invisible"></div>{{end}}
</div>
</div>
<div class="row" style="margin-top: 32px;">
@@ -89,8 +90,9 @@
var server;
// Define the function that submits a gist url to the server
- var submit = function() {
- server.send(JSON.stringify({url: $("#gist")[0].value}));
+ var submit = function({{if .Recaptcha}}captcha{{end}}) {
+ server.send(JSON.stringify({url: $("#gist")[0].value{{if .Recaptcha}}, captcha: captcha{{end}}}));{{if .Recaptcha}}
+ grecaptcha.reset();{{end}}
};
// Define a method to reconnect upon server loss
var reconnect = function() {
@@ -138,6 +140,7 @@
}
// Establish a websocket connection to the API server
reconnect();
- </script>
+ </script>{{if .Recaptcha}}
+ <script src="https://www.google.com/recaptcha/api.js" async defer></script>{{end}}
</body>
</html>