From fecf75ef2e67523d1a60dfba5947a7fe8e079bbf Mon Sep 17 00:00:00 2001 From: Brian Helba Date: Wed, 16 Feb 2022 01:49:06 -0500 Subject: [PATCH] Add templates for Django OAuth Toolkit authorization views --- .../templates/oauth2_provider/authorize.html | 40 ++++++++++++++++ .../oauth2_provider/authorized-oob.html | 23 +++++++++ .../templates/oauth2_provider/base.html | 48 +++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 auth_style/templates/oauth2_provider/authorize.html create mode 100644 auth_style/templates/oauth2_provider/authorized-oob.html create mode 100644 auth_style/templates/oauth2_provider/base.html diff --git a/auth_style/templates/oauth2_provider/authorize.html b/auth_style/templates/oauth2_provider/authorize.html new file mode 100644 index 0000000..96c4ca8 --- /dev/null +++ b/auth_style/templates/oauth2_provider/authorize.html @@ -0,0 +1,40 @@ +{% extends "oauth2_provider/base.html" %} + +{% load i18n %} +{% block content %} +
+ {% if not error %} +
+

{% trans "Authorize" %} {{ application.name }}?

+ {% csrf_token %} + + {% for field in form %} + {% if field.is_hidden %} + {{ field }} + {% endif %} + {% endfor %} + +

{% trans "Application requires the following permissions" %}

+
    + {% for scope in scopes_descriptions %} +
  • {{ scope }}
  • + {% endfor %} +
+ + {{ form.errors }} + {{ form.non_field_errors }} + +
+
+ + +
+
+
+ + {% else %} +

Error: {{ error.error }}

+

{{ error.description }}

+ {% endif %} +
+{% endblock %} diff --git a/auth_style/templates/oauth2_provider/authorized-oob.html b/auth_style/templates/oauth2_provider/authorized-oob.html new file mode 100644 index 0000000..78399da --- /dev/null +++ b/auth_style/templates/oauth2_provider/authorized-oob.html @@ -0,0 +1,23 @@ +{% extends "oauth2_provider/base.html" %} + +{% load i18n %} + +{% block title %} +Success code={{code}} +{% endblock %} + +{% block content %} +
+ {% if not error %} +

{% trans "Success" %}

+ +

{% trans "Please return to your application and enter this code:" %}

+ +

{{ code }}

+ + {% else %} +

Error: {{ error.error }}

+

{{ error.description }}

+ {% endif %} +
+{% endblock %} diff --git a/auth_style/templates/oauth2_provider/base.html b/auth_style/templates/oauth2_provider/base.html new file mode 100644 index 0000000..048c41f --- /dev/null +++ b/auth_style/templates/oauth2_provider/base.html @@ -0,0 +1,48 @@ + + + + + {% block title %}{% endblock title %} + + + + + {% block css %} + + {% endblock css %} + + + + + + +
+ {% block content %} + {% endblock content %} +
+ + +