Repository navigation
nav: log out with POST, as required by Django 5 - #789
Merged
Merged
Conversation
Since Django 5.0, LogoutView only accepts POST requests, so the "Log out" link in the user menu fails with HTTP 405. Replace it with a small form that POSTs to auth_logout, styled as a dropdown item.
Member
|
Thanks for writing tests, but I'm really not convinced about the value of any of these tests. The functionality isn't in wafer, it's in Django. |
They test Django's LogoutView rather than wafer.
Contributor
Author
@stefanor Thanks, I've dropped the tests. |
drnlm
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since Django 5.0,
LogoutViewonly accepts POST requests. The "Logout" item in the user menu is still a plain link (GET), so clicking it
gives an HTTP 405 and the user stays logged in.
This replaces the link with a small form that POSTs to
auth_logout(with a CSRF token), using the
dropdown-itemclass so it looks thesame as the other menu items.
Added tests checking that the menu uses a POST form, and that POSTing
to logout logs the user out.
The same fix for wafer-debconf's own menu, which overrides this one, is
in https://salsa.debian.org/debconf-team/public/websites/wafer-debconf/-/merge_requests/294
(issue https://salsa.debian.org/debconf-team/public/websites/wafer-debconf/-/issues/84).