From cdfbff0b6b5a8c5645ec4d08f019bb3b35112e1b Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Wed, 19 Nov 2025 16:29:50 -0800 Subject: [PATCH] oidc: Style the page for authorizing an OIDC app Tests: - Appearance is acceptable: top margin, width of the readable text, heading centering, list top/bottom margins, SVG icon for application, md mode icon size, submit button width, margins. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- debian/copyright | 1 + .../templates/oauth2_provider/authorize.html | 69 +++ static/themes/default/css/main.css | 39 ++ static/themes/default/img/application.svg | 515 ++++++++++++++++++ 4 files changed, 624 insertions(+) create mode 100644 plinth/modules/oidc/templates/oauth2_provider/authorize.html create mode 100644 static/themes/default/img/application.svg diff --git a/debian/copyright b/debian/copyright index d3fb07094..52aac5e7c 100644 --- a/debian/copyright +++ b/debian/copyright @@ -79,6 +79,7 @@ Files: plinth/modules/ejabberd/static/icons/ejabberd.png plinth/modules/rssbridge/static/icons/rssbridge.svg plinth/modules/zoph/static/icons/zoph.png plinth/modules/zoph/static/icons/zoph.svg + static/themes/default/img/application.svg static/themes/default/img/network-connection.svg static/themes/default/img/network-connection-vertical.svg static/themes/default/img/network-ethernet.svg diff --git a/plinth/modules/oidc/templates/oauth2_provider/authorize.html b/plinth/modules/oidc/templates/oauth2_provider/authorize.html new file mode 100644 index 000000000..60d689d84 --- /dev/null +++ b/plinth/modules/oidc/templates/oauth2_provider/authorize.html @@ -0,0 +1,69 @@ +{% extends "base.html" %} +{% comment %} +# SPDX-License-Identifier: AGPL-3.0-or-later +{% endcomment %} + +{% load i18n %} +{% load static %} +{% load bootstrap %} + +{% block wrapper %} +
+
+ {% trans + {% trans + {{ box_name }} +
+ +

{% trans "Authorize App" %}

+ + {% if not error %} +
+ {% csrf_token %} + + {% for field in form %} + {% if field.is_hidden %} + {{ field }} + {% endif %} + {% endfor %} + +
    +
  • + {% trans application.name as app %} + {% blocktrans trimmed with username=request.user.username %} + {{ app }} wants to access your account + {{ username }} + {% endblocktrans %} +
  • + {% for scope in scopes_descriptions %} +
  • {% trans scope %}
  • + {% endfor %} +
+ + {{ form.errors }} + {{ form.non_field_errors }} + +
+ +
+
+ +

+ {% blocktrans trimmed with url=form.redirect_uri.value %} + Authorizing will redirect to {{ url }} + {% endblocktrans %} +

+ {% else %} +

{% trans "Error:" %} {{ error.error }}

+

{{ error.description }}

+ {% endif %} + +
+{% endblock %} diff --git a/static/themes/default/css/main.css b/static/themes/default/css/main.css index d6d7ec504..d5808f69b 100644 --- a/static/themes/default/css/main.css +++ b/static/themes/default/css/main.css @@ -278,6 +278,11 @@ html { margin-bottom: 1.25rem; } +.narrow-container { + max-width: 496px; + margin-top: 4rem; +} + /* When an exception's text is shown in message as alert component, don't overflow the alert's width. */ .alert.d-flex div { @@ -1028,3 +1033,37 @@ textarea.log { width: 100%; text-wrap: nowrap; } + +/* + * OpenID Connect Authorization page. + */ +.authorize-container img { + display: block; + width: 100%; +} + +.authorize-container h3:first-of-type { + text-align: center; +} + +.authorize-container ul { + margin-top: 3rem; + margin-bottom: 3rem; +} + +.authorize-container .submit-container { + width: 100%; + margin: 4rem 0 1.5rem; +} + +.authorize-container .submit-container input { + width: 100%; + white-space: normal; +} + +@media (min-width: 576px) { + .authorize-diagram { + margin: 0 auto; + width: 80%; + } +} diff --git a/static/themes/default/img/application.svg b/static/themes/default/img/application.svg new file mode 100644 index 000000000..f57bbb90a --- /dev/null +++ b/static/themes/default/img/application.svg @@ -0,0 +1,515 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +