From 6be1e7df44e51bf7c5b3d9f4f56652041f7ad43f Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Fri, 23 Dec 2022 22:34:21 -0700 Subject: [PATCH] Make oauth screens plain as well --- activities/views/debug.py | 15 +++++++++++++++ static/css/style.css | 5 +++++ takahe/urls.py | 7 ++++--- templates/api/oauth_authorize.html | 11 ++++++++--- templates/api/oauth_code.html | 8 ++++++-- 5 files changed, 38 insertions(+), 8 deletions(-) diff --git a/activities/views/debug.py b/activities/views/debug.py index 794fb7d..b77a96c 100644 --- a/activities/views/debug.py +++ b/activities/views/debug.py @@ -56,3 +56,18 @@ class NotFound(TemplateView): class ServerError(TemplateView): template_name = "500.html" + + +@method_decorator(admin_required, name="dispatch") +class OauthAuthorize(TemplateView): + + template_name = "api/oauth_authorize.html" + + def get_context_data(self): + return { + "application": {"name": "Fake Application", "client_id": "fake"}, + "redirect_uri": "", + "scope": "read write push", + "identities": self.request.user.identities.all(), + "code": "12345abcde", + } diff --git a/static/css/style.css b/static/css/style.css index 31b7a9a..243a5d1 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -426,6 +426,11 @@ img.emoji { margin: 4px 0 10px 0; } +p.authorization-code { + margin: 10px 0; + font-size: 140%; +} + /* Icon menus */ .icon-menu .option { diff --git a/takahe/urls.py b/takahe/urls.py index 41a6d2c..e413c8b 100644 --- a/takahe/urls.py +++ b/takahe/urls.py @@ -211,9 +211,10 @@ urlpatterns = [ name="rules", ), # Debug aids - path("debug/json/", debug.JsonViewer.as_view(), name="debug_json"), - path("debug/404/", debug.NotFound.as_view(), name="not_found"), - path("debug/500/", debug.ServerError.as_view(), name="server_error"), + path("debug/json/", debug.JsonViewer.as_view()), + path("debug/404/", debug.NotFound.as_view()), + path("debug/500/", debug.ServerError.as_view()), + path("debug/oauth_authorize/", debug.OauthAuthorize.as_view()), # Media/image proxy path( "proxy/identity_icon//", diff --git a/templates/api/oauth_authorize.html b/templates/api/oauth_authorize.html index 41aac0d..472083f 100644 --- a/templates/api/oauth_authorize.html +++ b/templates/api/oauth_authorize.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "base_plain.html" %} {% block title %}Authorize {{ application.name }}{% endblock %} @@ -24,8 +24,13 @@ -

Do you want to give {{ application.name }} access to this identity?

-

It will have permission to: {{ scope }}

+

Do you want to give {{ application.name }} access to this identity?

+

It will have permission to:

+ diff --git a/templates/api/oauth_code.html b/templates/api/oauth_code.html index 34193b8..28350b4 100644 --- a/templates/api/oauth_code.html +++ b/templates/api/oauth_code.html @@ -1,7 +1,11 @@ -{% extends "base.html" %} +{% extends "base_plain.html" %} {% block title %}Authorization Code{% endblock %} {% block content %} -

To continue, provide this code to your application: {{ code }}

+

Authorization Code

+
+

To continue, provide this code to your application:

+

{{ code }}

+
{% endblock %}