diff --git a/umap/decorators.py b/umap/decorators.py index 5e808d12..a0bb757f 100644 --- a/umap/decorators.py +++ b/umap/decorators.py @@ -1,10 +1,11 @@ from functools import wraps from django.conf import settings +from django.core.exceptions import PermissionDenied from django.http import HttpResponseForbidden from django.shortcuts import get_object_or_404 from django.urls import reverse_lazy - +from django.utils.translation import gettext as _ from .models import Map, Team from .views import simple_json_response @@ -55,7 +56,7 @@ def can_view_map(view_func): map_inst = get_object_or_404(Map, pk=kwargs["map_id"]) kwargs["map_inst"] = map_inst # Avoid rerequesting the map in the view if not map_inst.can_view(request): - return HttpResponseForbidden() + raise PermissionDenied(_("This map is not publicly available")) return view_func(request, *args, **kwargs) return wrapper diff --git a/umap/static/umap/content.css b/umap/static/umap/content.css index 392ac85a..a9b849bc 100644 --- a/umap/static/umap/content.css +++ b/umap/static/umap/content.css @@ -208,31 +208,34 @@ input[type="submit"], } /* **************************** */ -/* 404 */ +/* 40x */ /* **************************** */ -.content404 { - width: 400px; +.content-40x { + width: 600px; margin-left: auto; margin-right: auto; margin-top: 100px; - text-align: center; } -.content404 a { +.content-40x a { color: #3A4259; } -.content404 h1 { - font-size: 10em; +.content-40x h1 { + font-size: 2em; margin-bottom: 0; line-height: 0.5em; margin-top: 40px; } -.content404 h2 { - font-size: 4em; - margin-top: 0; -} -.content404 img { +.content-404 img { width: 32%; } +.page-40x { + background-image: url('./img/logo_lightcyan.svg'); + background-repeat: no-repeat; + background-size: contain; + background-position: center; + width: 100vw; + height: 90vh; +} /* **************************** */ diff --git a/umap/static/umap/img/logo_lightcyan.svg b/umap/static/umap/img/logo_lightcyan.svg new file mode 100644 index 00000000..76afe72f --- /dev/null +++ b/umap/static/umap/img/logo_lightcyan.svg @@ -0,0 +1,7 @@ + + diff --git a/umap/templates/403.html b/umap/templates/403.html new file mode 100644 index 00000000..3423b869 --- /dev/null +++ b/umap/templates/403.html @@ -0,0 +1,11 @@ +{% extends "40x.html" %} + +{% load i18n %} + +{% block content %} +
{% blocktrans %}Find out here how to manage map permissions.{% endblocktrans %}
+ +