1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-10-04 01:17:49 +08:00

Add cookie to prevent captcha constantly

This commit is contained in:
Marcos Lilljedahl
2017-03-14 14:08:46 -03:00
parent 0770eb689b
commit a875bbe23e
4 changed files with 41 additions and 7 deletions

View File

@@ -12,8 +12,9 @@
<h1>Welcome!</h1>
<h2>Before starting we need to verify you are a human</h2>
<form id="welcomeForm" method="POST" action="/">
<div class="g-recaptcha" data-callback="iAmHuman" data-sitekey="{{.}}"></div>
<div id="recaptcha" class="g-recaptcha" data-callback="iAmHuman" data-sitekey="{{.}}"></div>
<input type="hidden" name="session-duration" value="4h"/>
<button id="create" style="display:none;">Create session</button>
</form>
<img src="/assets/large_h.png" />
</div>
@@ -22,6 +23,10 @@
function iAmHuman(resp) {
document.getElementById('welcomeForm').submit();
}
if (document.cookie.indexOf('session_id') > -1) {
document.getElementById('create').style = "";
document.getElementById('recaptcha').style = "display:none;";
}
</script>
</body>
</html>