From e42050343063db6ac7ccca29575543eb16d7ea41 Mon Sep 17 00:00:00 2001 From: groovecoder Date: Fri, 4 Apr 2014 14:08:26 -0500 Subject: [PATCH] add honeypot to signin page --- .../templates/users/browserid_signin.html | 18 ++++++++++++++++++ urls.py | 19 ++++++++++--------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/apps/users/templates/users/browserid_signin.html b/apps/users/templates/users/browserid_signin.html index c6d4055fe1c..f49fa790b85 100644 --- a/apps/users/templates/users/browserid_signin.html +++ b/apps/users/templates/users/browserid_signin.html @@ -13,3 +13,21 @@

{{ _('Sign In with Persona') }}

+ +{# hidden form to measure bot submissions from this page #} + diff --git a/urls.py b/urls.py index ac6e7f81bb4..3cf1cdd0275 100644 --- a/urls.py +++ b/urls.py @@ -6,7 +6,6 @@ from django.views.i18n import javascript_catalog from django.views.decorators.cache import cache_page -import jingo import badger @@ -14,6 +13,14 @@ badger.autodiscover() +# Handle 404 and 500 errors +def _error_page(request, status): + """Render error pages with jinja2.""" + return render(request, '%d.html' % status, status=status) +handler403 = lambda r: _error_page(r, 403) +handler404 = lambda r: _error_page(r, 404) +handler500 = lambda r: _error_page(r, 500) + urlpatterns = patterns('', # Home / landing pages: ('', include('landing.urls')), @@ -71,19 +78,13 @@ (r'^', include('tidings.urls')), (r'^humans.txt$', 'django.views.static.serve', {'document_root': settings.HUMANSTXT_ROOT, 'path': 'humans.txt'}), + + url(r'^miel$', handler500, name='users.honeypot'), ) if settings.DEBUG: urlpatterns += staticfiles_urlpatterns() -# Handle 404 and 500 errors -def _error_page(request, status): - """Render error pages with jinja2.""" - return render(request, '%d.html' % status, status=status) -handler403 = lambda r: _error_page(r, 403) -handler404 = lambda r: _error_page(r, 404) -handler500 = lambda r: _error_page(r, 500) - if settings.SERVE_MEDIA: media_url = settings.MEDIA_URL.lstrip('/').rstrip('/') urlpatterns += patterns('',