Add error view if digest is to long/short

This commit is contained in:
Oliver Falk
2018-11-23 15:52:41 +01:00
parent 93e0e624b5
commit e96e17bd01
2 changed files with 15 additions and 1 deletions

View File

@@ -20,6 +20,13 @@ urlpatterns = [ # pylint: disable=invalid-name
url( url(
r'avatar/(?P<digest>\w{32})', r'avatar/(?P<digest>\w{32})',
AvatarImageView.as_view(), name='avatar_view'), AvatarImageView.as_view(), name='avatar_view'),
url(
r'avatar/(?P<digest>\w)',
TemplateView.as_view(
template_name='error.html',
extra_context={
'errormessage': 'Incorrect digest length',
})),
url('description/', TemplateView.as_view(template_name='description.html'), name='description'), url('description/', TemplateView.as_view(template_name='description.html'), name='description'),
# The following two are TODO TODO TODO TODO TODO # The following two are TODO TODO TODO TODO TODO
url('run_your_own/', TemplateView.as_view(template_name='run_your_own.html'), name='run_your_own'), url('run_your_own/', TemplateView.as_view(template_name='run_your_own.html'), name='run_your_own'),

View File

@@ -8,7 +8,14 @@
{% block content %} {% block content %}
<h1 class="error">{% trans 'Error!' %}</h1> <h1 class="error">{% trans 'Error!' %}</h1>
<p>{% block errormessage %}{% trans 'Libravatar has encountered an error.' %}{% endblock errormessage %}</p> <p>{% block errormessage %}
{% trans 'Libravatar has encountered an error.' %}
{% if errormessage %}
<br/>
<br/>
{% blocktrans %}{{ errormessage }}{% endblocktrans %}
{% endif %}
{% endblock errormessage %}</p>
<div style="height:40px"></div> <div style="height:40px"></div>