add in a 403 page
This commit is contained in:
Родитель
aa7802c951
Коммит
b1b1059b8e
|
@ -0,0 +1,18 @@
|
|||
{% extends "impala/base.html" %}
|
||||
|
||||
{% block title %}{{ _('Oops') }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section class="primary">
|
||||
{% trans %}
|
||||
<h1>Oops! Not allowed.</h1>
|
||||
<p>You tried to do something that you weren't allowed to.</p>
|
||||
{% endtrans %}
|
||||
{% if csrf %}
|
||||
{% trans %}
|
||||
<p>Try going back to the previous page, refreshing
|
||||
and then trying again.</p>
|
||||
{% endtrans %}
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endblock %}
|
|
@ -190,14 +190,19 @@ def _paypal(request):
|
|||
|
||||
|
||||
def handler404(request):
|
||||
return jingo.render(request, 'amo/404.lhtml', status=404)
|
||||
return jingo.render(request, 'amo/404.html', status=404)
|
||||
|
||||
|
||||
def handler500(request):
|
||||
arecibo = getattr(settings, 'ARECIBO_SERVER_URL', '')
|
||||
if arecibo:
|
||||
post(request, 500)
|
||||
return jingo.render(request, 'amo/500.lhtml', status=500)
|
||||
return jingo.render(request, 'amo/500.html', status=500)
|
||||
|
||||
|
||||
def csrf_failure(request, reason=''):
|
||||
return jingo.render(request, 'amo/403.html',
|
||||
{'csrf': 'CSRF' in reason}, status=403)
|
||||
|
||||
|
||||
def loaded(request):
|
||||
|
|
|
@ -1160,3 +1160,5 @@ WATERMARK_REUSE_SECONDS = 1800
|
|||
# by a cron. Setting this far apart from the reuse flag so that we
|
||||
# shouldn't have an overlap.
|
||||
WATERMARK_CLEANUP_SECONDS = 3600
|
||||
|
||||
CSRF_FAILURE_VIEW = 'amo.views.csrf_failure'
|
||||
|
|
Загрузка…
Ссылка в новой задаче