fix cancel button in authorization page when user is not login

This commit is contained in:
Son NK 2019-09-02 17:26:29 +02:00
parent 232d250186
commit 4c34775aa2
3 changed files with 21 additions and 9 deletions

View File

@ -7,17 +7,17 @@
<ul class="mt-3">
{% for scope in client.get_scopes() %}
<li>
{% if scope == Scope.AVATAR_URL %}
avatar
{% else %}
{{ scope.value }}
{% endif %}
{% if scope == Scope.AVATAR_URL %}
avatar
{% else %}
{{ scope.value }}
{% endif %}
</li>
{% endfor %}
</ul>
<label>
In order to accept the request, you need to login or sign up.
In order to accept the request, you need to sign in.
</label>
</div>
@ -37,9 +37,11 @@
<hr>
<div class="row">
<a class="btn btn-block btn-secondary" href="javascript:history.back()">
<p class="text-center col">Cancel and go back to <b>{{ client.name }}</b></p>
<a class="btn btn-block btn-secondary back-or-close">
<i class="fe fe-arrow-left mr-2"></i>Cancel
</a>
</div>
{% endblock %}
{% endblock %}

View File

@ -129,6 +129,16 @@
e.clearSelection();
});
// Handle back or close button
$('.back-or-close').on("click", function () {
// the window is actually a popup, in this case just close it
if (history.length == 1) {
window.close();
} else {
history.back();
}
});
</script>
<!-- For additional script -->

View File

@ -55,7 +55,7 @@ def test_authorize_page_non_login_user(flask_client):
html = r.get_data(as_text=True)
assert r.status_code == 200
assert "In order to accept the request, you need to login or sign up" in html
assert "In order to accept the request, you need to sign in" in html
def test_authorize_page_login_user_non_supported_flow(flask_client):