Added captcha and error handling to newsletter form

There are some errors that can happen when submitting the subscription
request and we don't want to have any styled pages on the donate site
once we finish moving the donate pages to lektor, so we need to have the
donate site redirect with error messages back to the original page, then
use Javascript to get the errors displayed.

Issue #48283
This commit is contained in:
Peter Haight 2020-09-22 15:10:36 -07:00
parent 868becffad
commit 8fb60a284a
3 changed files with 21 additions and 4 deletions

2
lego

@ -1 +1 @@
Subproject commit 7f2289bf68685da40878bb09ee91346057c443d3
Subproject commit 925c4c1761ca69c4367f79b15ed9a2bc19a19a33

View File

@ -30,16 +30,32 @@
<div class="row mb-1">
<div class="col-12">
<div class="row mt-4 mb-2">
<form action="https://donate.torproject.org/subscription-request" method="POST" class="form-wide">
<form action="https://tor-donate.local/subscription-request" method="POST" class="form-wide">
<input type="hidden" name="returnToReferrer" value="1" />
<div class="form-group row">
<div class="col-sm-10">
<div class="col-sm-12 errors">
</div>
</div>
<div class="form-group row">
<div class="col-sm-12">
<input class="form-control form-control-lg form-required" id="email"
name="email" placeholder="* Email Address" value="" type="email" />
</div>
<input class="donate btn btn-lg btn-success btn-block col-2" value="Join" type="submit" />
</div>
<div class="form-group row">
<div class="col-sm-6 captcha">
<input id="captcha" type="text" class="form-control form-control-lg form-required" data-name="captcha" data-stripe="captcha" aria-label="captcha" name="captcha" size="4" placeholder="* Enter the 4 letters (case insenstive) that appear below">
<img src="https://tor-donate.local/captcha" border="0" />
</div>
</div>
<div class="form-group row">
<div class="col-sm-12">
<input class="donate btn btn-lg btn-success btn-block col-2" value="Join" type="submit" />
</div>
</div>
</form>
</div>
</div>
</div>
<script src="{{ '/static/js/errors.js'|asseturl }}" ></script>
{% endblock %}

View File

@ -2,6 +2,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="{{ '/static/style.css'|asseturl }}">
<script src="{{ '/static/js/errors.js'|asseturl }}"></script>
<title>{% block title %}{{ this.title }}{% endblock %}</title>
<body>