Skip to content

Commit

Permalink
views: Switch logout to POST
Browse files Browse the repository at this point in the history
This was deprecated in 4.1 and removed in 5.0. I missed it.

[1] https://docs.djangoproject.com/en/5.0/releases/4.1/#features-deprecated-in-4-1

Signed-off-by: Stephen Finucane <[email protected]>
(cherry picked from commit 45f47e9)
  • Loading branch information
stephenfin committed Nov 1, 2024
1 parent 794bdb9 commit 5b5fef5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
28 changes: 28 additions & 0 deletions htdocs/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,34 @@ pre {
color: #999;
}

ul.dropdown-menu > li > form {
display: block;
width: 100%;
}

ul.dropdown-menu > li > form > button {
/* taken from bootstrap's styling for '.dropdown-menu > li > a' */
background: none;
border: none;
cursor: pointer;
display: block;
padding: 3px 20px;
clear: both;
font-weight: 400;
line-height: 1.42857143;
color: #333;
white-space: nowrap;
width: 100%;
text-align: left;
}

ul.dropdown-menu > li > form > button:hover {
/* taken from bootstrap's styling for '.dropdown-menu > li > a:hover' */
color: #262626;
text-decoration: none;
background-color: #f5f5f5;
}

form {
padding: 0em;
margin: 0em;
Expand Down
7 changes: 6 additions & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@
<li><a href="{% url 'admin:index' %}">Administration</a></li>
{% endif %}
<li><a href="{% url 'user-profile' %}">View profile</a></li>
<li><a href="{% url 'auth_logout' %}">Logout</a></li>
<li>
<form id="logout-form" method="post" action="{% url 'auth_logout' %}">
{% csrf_token %}
<button type="submit">Logout</button>
</form>
</li>
</ul>
</li>
{% else %}
Expand Down

0 comments on commit 5b5fef5

Please sign in to comment.