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; display:block;
} }
.antispams { display:none;} .matngot { display:none;}

View File

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

View File

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