From 8a5b1f263e0ba01b52290ad26f7630a769128922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 25 May 2021 13:20:24 -0700 Subject: [PATCH] new: Fake field to avoid dumb bots --- website/web/__init__.py | 4 ++++ website/web/static/generic.css | 11 +++++++++++ website/web/templates/tree.html | 5 +++++ 3 files changed, 20 insertions(+) diff --git a/website/web/__init__.py b/website/web/__init__.py index c59c354d..6d9deae0 100644 --- a/website/web/__init__.py +++ b/website/web/__init__.py @@ -475,6 +475,10 @@ def cache_tree(tree_uuid: str): def send_mail(tree_uuid: str): if not enable_mail_notification: return redirect(url_for('tree', tree_uuid=tree_uuid)) + if request.form.get('name'): + # got a bot. + logging.info(f'{src_request_ip(request)} is a bot - {request.headers.get("User-Agent")}.') + return redirect('https://www.youtube.com/watch?v=iwGFalTRHDA') email: str = request.form['email'] if request.form.get('email') else '' if '@' not in email: # skip clearly incorrect emails diff --git a/website/web/static/generic.css b/website/web/static/generic.css index d1fa3ea2..8703fffa 100644 --- a/website/web/static/generic.css +++ b/website/web/static/generic.css @@ -85,3 +85,14 @@ table td p { padding: 5px; width: 150px; } + +/* boaty */ +.boatymcboat { + opacity: 0; + position: absolute; + top: 0; + left: 0; + height: 0; + width: 0; + z-index: -1; +} diff --git a/website/web/templates/tree.html b/website/web/templates/tree.html index 7a306c4f..e0357787 100644 --- a/website/web/templates/tree.html +++ b/website/web/templates/tree.html @@ -488,6 +488,11 @@
+ + + +