From b25245f42cd7e339d21f48286361cd8b22b39406 Mon Sep 17 00:00:00 2001
From: Art Lukyanchyk <artiom.lukyanchyk@hs-hannover.de>
Date: Mon, 15 Jan 2018 14:22:10 +0100
Subject: [PATCH] I already foresee angry confused users, so I added a verbose
 403 page :)

---
 ssoauth/templates/403.html | 14 ++++++++++++++
 ssoauth/views.py           |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 ssoauth/templates/403.html

diff --git a/ssoauth/templates/403.html b/ssoauth/templates/403.html
new file mode 100644
index 0000000..2c38c4e
--- /dev/null
+++ b/ssoauth/templates/403.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>403</title>
+</head>
+<body>
+<h1>403 Forbidden</h1>
+<p>
+    You (<code><strong>{{ request.user }}</strong></code>) don't have permissions to access this page.
+</p>
+{% if not request.user.is_anonymous %}<p><a href="{% url "sso-logout" %}">Log Out</a></p>{% endif %}
+</body>
+</html>
diff --git a/ssoauth/views.py b/ssoauth/views.py
index 91904f1..b9dc9e2 100644
--- a/ssoauth/views.py
+++ b/ssoauth/views.py
@@ -104,7 +104,7 @@ class LoggedOutLocallyView(TemplateView):
 
     def get_context_data(self, **kwargs):
         context = super().get_context_data(**kwargs)
-        context["IDP_LOGOUT_URL"] = app_settings.IDP_LOGOUT_URL
+        context["IDP_LOGOUT_URL"] = app_settings.IDP_LOGOUT_URL or "#"
         context["THIS_SITE"] = get_current_site(self.request)
         return context
 
-- 
GitLab