OAuth authorize dialog: Show which user you are logged in as

This commit is contained in:
Raphael Michel
2021-04-11 15:10:10 +02:00
parent 3044b9346a
commit 0a6b53b63b
3 changed files with 68 additions and 36 deletions

View File

@@ -1,5 +1,6 @@
{% load compress %} {% load compress %}
{% load i18n %} {% load i18n %}
{% load hijack_tags %}
{% load static %} {% load static %}
<!DOCTYPE html> <!DOCTYPE html>
<html{% if rtl %} dir="rtl" class="rtl"{% endif %}> <html{% if rtl %} dir="rtl" class="rtl"{% endif %}>
@@ -38,6 +39,20 @@
</div> </div>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if request|is_hijacked %}
<div class="impersonate-warning">
<span class="fa fa-user-secret"></span>
{% blocktrans with user=request.user%}You are currently working on behalf of {{ user }}.{% endblocktrans %}
<form action="{% url 'control:users.impersonate.stop' %}" method="post" class="helper-display-inline">
{% csrf_token %}
<button class="btn btn-default btn-sm">
{% trans "Stop impersonating" %}
</button>
</form>
</div>
{% endif %}
{% block content %} {% block content %}
{% endblock %} {% endblock %}
<footer> <footer>

View File

@@ -20,6 +20,11 @@
pretix account? pretix account?
{% endblocktrans %} {% endblocktrans %}
</p> </p>
<p>
{% blocktrans trimmed with user=request.user %}
You are currently logged in as <strong>{{ user }}</strong>.
{% endblocktrans %}
</p>
<p>{% trans "The application requires the following permissions:" %}</p> <p>{% trans "The application requires the following permissions:" %}</p>
<ul> <ul>
{% for scope in scopes_descriptions %} {% for scope in scopes_descriptions %}

View File

@@ -56,5 +56,17 @@ footer {
margin-bottom: 20px; margin-bottom: 20px;
} }
.impersonate-warning {
background-color: #ffe761;
background-image: -webkit-linear-gradient(-45deg, rgba(0, 0, 0, .04) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, .04) 50%, rgba(0, 0, 0, .04) 75%, transparent 75%, transparent);
background-image: -moz-linear-gradient(-45deg, rgba(0, 0, 0, .04) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, .04) 50%, rgba(0, 0, 0, .04) 75%, transparent 75%, transparent);
background-image: linear-gradient(135deg, rgba(0, 0, 0, .04) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, .04) 50%, rgba(0, 0, 0, .04) 75%, transparent 75%, transparent);
padding: 15px;
max-width: 330px;
box-shadow: 0 7px 14px 0 rgba(78, 50, 92, 0.1),0 3px 6px 0 rgba(0,0,0,.07);
margin: 15px auto;
border-radius: $border-radius-base;
}
@import "../../pretixbase/scss/_rtl.scss"; @import "../../pretixbase/scss/_rtl.scss";
@import "../../bootstrap/scss/_rtl.scss"; @import "../../bootstrap/scss/_rtl.scss";