mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-26 18:37:12 +00:00
Fix scope view
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
6bf16a181a
commit
132afc3d15
@ -11,25 +11,25 @@
|
|||||||
<div class="accordion" id="accordionApps">
|
<div class="accordion" id="accordionApps">
|
||||||
{% for app, app_scopes in scopes.items %}
|
{% for app, app_scopes in scopes.items %}
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header" id="app-{{ app.name.lower }}-title">
|
<div class="card-header" id="app-{{ app.name|slugify }}-title">
|
||||||
<a class="text-decoration-none collapsed" href="#" data-toggle="collapse"
|
<a class="text-decoration-none collapsed" href="#" data-toggle="collapse"
|
||||||
data-target="#app-{{ app.name.lower }}" aria-expanded="false"
|
data-target="#app-{{ app.name|slugify }}" aria-expanded="false"
|
||||||
aria-controls="app-{{ app.name.lower }}">
|
aria-controls="app-{{ app.name|slugify }}">
|
||||||
{{ app.name }}
|
{{ app.name }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="collapse" id="app-{{ app.name.lower }}" aria-labelledby="app-{{ app.name.lower }}" data-target="#accordionApps">
|
<div class="collapse" id="app-{{ app.name|slugify }}" aria-labelledby="app-{{ app.name|slugify }}" data-target="#accordionApps">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
{% for scope_id, scope_desc in app_scopes.items %}
|
{% for scope_id, scope_desc in app_scopes.items %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-check-label" for="scope-{{ app.name.lower }}-{{ scope_id }}">
|
<label class="form-check-label" for="scope-{{ app.name|slugify }}-{{ scope_id }}">
|
||||||
<input type="checkbox" id="scope-{{ app.name.lower }}-{{ scope_id }}"
|
<input type="checkbox" id="scope-{{ app.name|slugify }}-{{ scope_id }}"
|
||||||
name="scope-{{ app.name.lower }}" class="checkboxinput form-check-input" value="{{ scope_id }}">
|
name="scope-{{ app.name|slugify }}" class="checkboxinput form-check-input" value="{{ scope_id }}">
|
||||||
{{ scope_desc }}
|
{{ scope_desc }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<p id="url-{{ app.name.lower }}">
|
<p id="url-{{ app.name|slugify }}">
|
||||||
<a href="{% url 'oauth2_provider:authorize' %}?client_id={{ app.client_id }}&response_type=code" target="_blank">
|
<a href="{% url 'oauth2_provider:authorize' %}?client_id={{ app.client_id }}&response_type=code" target="_blank">
|
||||||
{{ request.scheme }}://{{ request.get_host }}{% url 'oauth2_provider:authorize' %}?client_id={{ app.client_id }}&response_type=code
|
{{ request.scheme }}://{{ request.get_host }}{% url 'oauth2_provider:authorize' %}?client_id={{ app.client_id }}&response_type=code
|
||||||
</a>
|
</a>
|
||||||
@ -51,11 +51,10 @@
|
|||||||
{% block extrajavascript %}
|
{% block extrajavascript %}
|
||||||
<script>
|
<script>
|
||||||
{% for app in scopes.keys %}
|
{% for app in scopes.keys %}
|
||||||
let elements = document.getElementsByName("scope-{{ app.name.lower }}");
|
for (let element of document.getElementsByName("scope-{{ app.name|slugify }}")) {
|
||||||
for (let element of elements) {
|
|
||||||
element.onchange = function (event) {
|
element.onchange = function (event) {
|
||||||
let scope = ""
|
let scope = ""
|
||||||
for (let element of elements) {
|
for (let element of document.getElementsByName("scope-{{ app.name|slugify }}")) {
|
||||||
if (element.checked) {
|
if (element.checked) {
|
||||||
scope += element.value + " "
|
scope += element.value + " "
|
||||||
}
|
}
|
||||||
@ -63,7 +62,7 @@
|
|||||||
|
|
||||||
scope = scope.substr(0, scope.length - 1)
|
scope = scope.substr(0, scope.length - 1)
|
||||||
|
|
||||||
document.getElementById("url-{{ app.name.lower }}").innerHTML = 'Scopes : ' + scope
|
document.getElementById("url-{{ app.name|slugify }}").innerHTML = 'Scopes : ' + scope
|
||||||
+ '<br><a href="{% url 'oauth2_provider:authorize' %}?client_id={{ app.client_id }}&response_type=code&scope='+ scope.replaceAll(' ', '%20')
|
+ '<br><a href="{% url 'oauth2_provider:authorize' %}?client_id={{ app.client_id }}&response_type=code&scope='+ scope.replaceAll(' ', '%20')
|
||||||
+ '" target="_blank">{{ request.scheme }}://{{ request.get_host }}{% url 'oauth2_provider:authorize' %}?client_id={{ app.client_id }}&response_type=code&scope='
|
+ '" target="_blank">{{ request.scheme }}://{{ request.get_host }}{% url 'oauth2_provider:authorize' %}?client_id={{ app.client_id }}&response_type=code&scope='
|
||||||
+ scope.replaceAll(' ', '%20') + '</a>'
|
+ scope.replaceAll(' ', '%20') + '</a>'
|
||||||
|
Loading…
Reference in New Issue
Block a user