Make oauth screens plain as well

This commit is contained in:
Andrew Godwin 2022-12-23 22:34:21 -07:00
parent d88db5efbf
commit 6be1e7df44
5 changed files with 38 additions and 8 deletions

View File

@ -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",
}

View File

@ -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 {

View File

@ -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/<identity_id>/",

View File

@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "base_plain.html" %}
{% block title %}Authorize {{ application.name }}{% endblock %}
@ -24,8 +24,13 @@
</select>
</div>
</div>
<p>Do you want to give {{ application.name }} access to this identity?</p>
<p>It will have permission to: {{ scope }}</p>
<p>Do you want to give <b>{{ application.name }}</b> access to this identity?</p>
<p>It will have permission to:</p>
<ul>
{% if "read" in scope %}<li>Read all of your data</li>{% endif %}
{% if "write" in scope %}<li>Create posts, edit follows, and change all other data</li>{% endif %}
{% if "push" in scope %}<li>Receive push notifications</li>{% endif %}
</ul>
<input type="hidden" name="client_id" value="{{ application.client_id }}">
<input type="hidden" name="redirect_uri" value="{{ redirect_uri }}">
<input type="hidden" name="scope" value="{{ scope }}">

View File

@ -1,7 +1,11 @@
{% extends "base.html" %}
{% extends "base_plain.html" %}
{% block title %}Authorization Code{% endblock %}
{% block content %}
<p>To continue, provide this code to your application: <tt>{{ code }}</tt></p>
<h1>Authorization Code</h1>
<section>
<p>To continue, provide this code to your application:</p>
<p class="authorization-code">{{ code }}</p>
</section>
{% endblock %}