tuning anti-spam honeypot
This commit is contained in:
@@ -224,4 +224,4 @@ blockquote {
|
|||||||
display:block;
|
display:block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.antispams { display:none;}
|
.matngot { display:none;}
|
||||||
@@ -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>
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user