2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-25 16:51:54 +00:00

preventing _edit_edit_edit* loops by bots

This commit is contained in:
Philip Sargent 2024-04-10 20:24:27 +01:00
parent 2743be281e
commit 65f0c1e29f
3 changed files with 20 additions and 16 deletions

View File

@ -79,6 +79,8 @@ class FixturePageTests(TestCase):
""" """
# The fixtures have a password hash which is compatible with plain-text password 'secretword' # The fixtures have a password hash which is compatible with plain-text password 'secretword'
# The hash CHANGES whenever Django upgrades the encryption key length. Better to create the test uses
# algorithmically and not via a fixture.
fixtures = ["auth_users", "expo_caves", "expo_exped"] fixtures = ["auth_users", "expo_caves", "expo_exped"]
ph = r"and leads in 800m of tortuous going to" ph = r"and leads in 800m of tortuous going to"

View File

@ -57,7 +57,9 @@ def expofiles_redirect(request, filepath):
return redirect(urljoin("http://expo.survex.com/expofiles/", filepath)) return redirect(urljoin("http://expo.survex.com/expofiles/", filepath))
def spider(request, _): def spider(request, _):
return redirect("/?#") # so that suffixes applied by spider are no longer part of the url # urls ending in "_edit_edit"
return render(request, "pagenotfound.html", {"path": path}, status=404)
# return redirect("/?#") # so that suffixes applied by spider are no longer part of the url
def map(request): def map(request):
"""Serves unadorned the expoweb/map/slippy/map.html file""" """Serves unadorned the expoweb/map/slippy/map.html file"""

View File

@ -19,28 +19,28 @@ div#editLinks a{
} }
</style> </style>
{% endblock %} {% endblock %}
{% block title %}Page not found {{ path }}{% endblock %} {% block title %}Page not found '{{ path }}'{% endblock %}
{% block body %} {% block body %}
<h1>Page not found {{ path }}</h1> <h1>Page not found '{{ path }}'</h1>
<div id="editLinks"> {% block loginInfo %} <div >
<a href="/">Home</a> | {% if user.username %}user: '{{ user.username }}'
<a id="cuccLink" href="http://camcaving.uk/">CUCC</a> | | <a <a href='/accounts/logout/'>Log out</a>
<a id="expoWebsiteLink" href="http://expo.survex.com">expo.survex</a> | {% else %} <a href='/accounts/login/'>Log in</a>
{% if user.username %}User:{{ user.username }} {% endif %}
{% if user.person %}(<a href="{{ user.person.get_absolute_url }}">{{ user.person }}</a>){% endif %}
| <a <a href='/accounts/logout/'>Log out</a> {% else %} <a href='/accounts/login/'>Log in</a> {% endif %}
</div> </div>
{% endblock%}
<p>Probably a mistake. <p>Probably a mistake.
This page does not exist. This page does not exist.
Did you mistype the URL '<b>{{ path }}</b>' ?
Did you mistype a URL? {% if user.username %}
If you do want to create this page click <a href="{%url "editexpopage" path %} ">this link</a>. <p>
If you do want to create this page, click <a href="{%url "editexpopage" path %} ">this link</a>.
{% endif %}
<p>
<p> <p>
<p>Did you get lost ?</p> <p>Did you get lost ?</p>
<img align=center src="/handbook/i/204-area.png"> <img align=center src="/handbook/i/204-area.png">