tuning anti-spam honeypot

This commit is contained in:
2022-06-05 07:55:40 +02:00
parent 792a1927c4
commit 5e8332679d
3 changed files with 6 additions and 6 deletions

View File

@@ -224,4 +224,4 @@ blockquote {
display:block;
}
.antispams { display:none;}
.matngot { display:none;}

View File

@@ -159,7 +159,7 @@
</div>
<textarea class="form-control" id="comments" name="comments" placeholder="Message - Tin nhắn" required rows="5"></textarea>
<p class="antispams"><input class="form-control" id="antispams" name="antispams" type="text"></p>
<p class="matngot"><input class="form-control" id="matngot" name="matngot" type="text"></p>
<br>
<button class="btn btn-primary" type="submit" name="form.submitted">Envoyer</button>
</form>

View File

@@ -43,16 +43,16 @@ def home(request):
name = ''
email = ''
comments = ''
antispams = ''
matngot = ''
if 'form.submitted' in request.params :
name = request.params['name']
email = request.params['email']
comments = request.params['comments']
antispams = request.params['antispams']
matngot = request.params['matngot']
# antispams filled ?
if not antispams and comments != '':
# honeypot matngot filled ?
if not matngot and comments != '':
# no, message is not spam, send it
body = """
Bonjour,