svthalia/concrexit

View on GitHub
website/templates/oauth2_provider/authorize.html

Summary

Maintainability
Test Coverage
{% extends "small_page.html" %}
{% load i18n django_bootstrap5 alert %}

{% comment %}This page is automatically used by django-oauth-toolkit{% endcomment %}

{% block title %}{% trans "authorise application"|capfirst %} — {{ block.super }}{% endblock %}
{% block opengraph_title %}{% trans "authorise application"|capfirst %} — {{ block.super }}{% endblock %}

{% block page_title %}
    {% if not error %}
        {% trans "authorise"|capfirst %} {{ application.name }}
    {% else %}
        {% trans "error"|capfirst %}
    {% endif %}
{% endblock %}

{% block page_content %}
     {% if not error %}
        <form class="col-12" method="post">
            {% csrf_token %}
            {% for field in form %}
                {% if field.is_hidden %}
                    {{ field }}
                {% endif %}
            {% endfor %}
            <p>{% trans "Application requires following permissions" %}:</p>
            <ul>
                {% for scope in scopes_descriptions %}
                    <li>{{ scope }}</li>
                {% endfor %}
            </ul>
            {{ form.errors }}
            {{ form.non_field_errors }}
            <div class="form-row mt-4">
                <input type="submit" class="btn btn-success w-100" name="allow" value="{% trans "confirm"|capfirst %}" />
                <input type="submit" class="btn btn-danger w-100 mt-4" value="{% trans "cancel"|capfirst %}" />
            </div>
        </form>
     {% else %}
         <h4>{{ error.error }}</h4>
         <p>{{ error.description }}</p>
     {% endif %}
{% endblock %}