{% extends 'base.html' %}
{% load scope %}
{% block content %}
    {% if not error %}
        <p>{{ client.name }} would like to access your data with the following permissions:</p>
        <ul>
            {% for permission in oauth_data.scope %}
                <li>
                    {% if permission.description %}
                        {{ permission.description }}
                    {% else %}
                        {{ permission.name }}
                    {% endif %}
                </li>
            {% endfor %}
        </ul>
        <form method="post" action="{% url "oauth2:authorize" %}">
            {% csrf_token %}
            {{ form.errors }}
            {{ form.non_field_errors }}
            <fieldset>
                <div style="display: none;" />
                    <select type="select" name="scope" multiple="multiple">
                    {% for scope in oauth_data.scope %}
                        <option value="{{ scope.name }}" selected="selected">
                            {% if scope.description %}
                                {{ scope.description }}
                            {% else %}
                                {{ scope.name }}
                            {% endif %}
                        </option>
                    {% endfor %}
                    </select>
                </div>
                <input type="submit" class="btn login large danger" value="Cancel" />
                <input type="submit" class="btn login large primary" name="authorize" value="Authorize" />
            </fieldset>
        </form>
    {% else %}
        {{ error }}
        {{ error_description }}
    {% endif %}
{% endblock %}
