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