Skip to content

Commit

Permalink
Refs #15619 -- Logged out with POST requests in admin.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixxm committed Mar 24, 2022
1 parent 1b695fb commit 94d8ed5
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 44 deletions.
25 changes: 20 additions & 5 deletions django/contrib/admin/static/admin/css/base.css
Expand Up @@ -878,7 +878,7 @@ a.deletelink:focus, a.deletelink:hover {
overflow: hidden;
}

#header a:link, #header a:visited {
#header a:link, #header a:visited, #logout-form button {
color: var(--header-link-color);
}

Expand Down Expand Up @@ -914,22 +914,37 @@ a.deletelink:focus, a.deletelink:hover {
text-decoration: none;
}

#logout-form {
display: inline;
}

#logout-form button {
background: none;
border: 0;
cursor: pointer;
font-family: "Roboto","Lucida Grande","DejaVu Sans","Bitstream Vera Sans",Verdana,Arial,sans-serif;
}

#user-tools {
float: right;
padding: 0;
margin: 0 0 0 20px;
text-align: right;
}

#user-tools, #logout-form button{
padding: 0;
font-weight: 300;
font-size: 0.6875rem;
letter-spacing: 0.5px;
text-transform: uppercase;
text-align: right;
}

#user-tools a {
#user-tools a, #logout-form button {
border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}

#user-tools a:focus, #user-tools a:hover {
#user-tools a:focus, #user-tools a:hover,
#logout-form button:active, #logout-form button:hover {
text-decoration: none;
border-bottom-color: var(--primary);
color: var(--primary);
Expand Down
5 changes: 4 additions & 1 deletion django/contrib/admin/templates/admin/base.html
Expand Up @@ -55,7 +55,10 @@
{% if user.has_usable_password %}
<a href="{% url 'admin:password_change' %}">{% translate 'Change password' %}</a> /
{% endif %}
<a href="{% url 'admin:logout' %}">{% translate 'Log out' %}</a>
<form id="logout-form" method="post" action="{% url 'admin:logout' %}">
{% csrf_token %}
<button type="submit">{% translate 'Log out' %}</button>
</form>
{% endblock %}
</div>
{% endif %}
Expand Down
@@ -1,6 +1,12 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
{% block userlinks %}{% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% translate 'Documentation' %}</a> / {% endif %}{% translate 'Change password' %} / <a href="{% url 'admin:logout' %}">{% translate 'Log out' %}</a>{% endblock %}
{% block userlinks %}
{% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% translate 'Documentation' %}</a> / {% endif %}{% translate 'Change password' %} /
<form id="logout-form" method="post" action="{% url 'admin:logout' %}">
{% csrf_token %}
<button type="submit">{% translate 'Log out' %}</button>
</form>
{% endblock %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
Expand Down
@@ -1,7 +1,13 @@
{% extends "admin/base_site.html" %}
{% load i18n static %}
{% block extrastyle %}{{ block.super }}<link rel="stylesheet" href="{% static "admin/css/forms.css" %}">{% endblock %}
{% block userlinks %}{% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% translate 'Documentation' %}</a> / {% endif %} {% translate 'Change password' %} / <a href="{% url 'admin:logout' %}">{% translate 'Log out' %}</a>{% endblock %}
{% block userlinks %}
{% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% translate 'Documentation' %}</a> / {% endif %} {% translate 'Change password' %} /
<form id="logout-form" method="post" action="{% url 'admin:logout' %}">
{% csrf_token %}
<button type="submit">{% translate 'Log out' %}</button>
</form>
{% endblock %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
Expand Down
2 changes: 2 additions & 0 deletions docs/releases/4.1.txt
Expand Up @@ -436,6 +436,8 @@ Miscellaneous
* The ``size`` argument of the undocumented
``django.views.static.was_modified_since()`` function is removed.

* The admin log out UI now uses ``POST`` requests.

.. _deprecated-features-4.1:

Features deprecated in 4.1
Expand Down

0 comments on commit 94d8ed5

Please sign in to comment.