Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logout stops working with Django >4.0 #1174

Open
jorge-leon opened this issue Apr 26, 2024 · 2 comments · May be fixed by #1181
Open

logout stops working with Django >4.0 #1174

jorge-leon opened this issue Apr 26, 2024 · 2 comments · May be fixed by #1181
Labels
bug Something isn't working or is broken

Comments

@jorge-leon
Copy link

Describe the bug

Since Django 4.1 the contributed LogoutView requires the POST method, see:

https://docs.djangoproject.com/en/4.1/releases/4.1/#log-out-via-get

Find attached a patch which replaces the logout link (<a href=...) with a form. In order to maintain formatting
a label with a hidden submit button is used. I do not know if this works for all browsers.

django_logout_post.patch.txt

Note: in urls.py the next_page parameter uses a plain ../ which might not do what is meant in all situations. It could be
replaced by reverse_lazy("helpdesk:home"), however I plan to integrate a more general solution in a future PR for improving
integration of django-helpdesk into a django-project with other apps.

To Reproduce
Steps to reproduce the behavior:

  1. Install django-helpdesk with a Django version greater or equal to 4.1
  2. Set up a user and login
  3. Click on the "Logout" link in the user dropdown
  4. Click on the back button of the browser and optionally reload
  5. The user is still logged in.

Expected behavior

The user is logged out

@jorge-leon jorge-leon added the bug Something isn't working or is broken label Apr 26, 2024
@uhurusurfa
Copy link
Collaborator

👍 Look forward to the PR

@jorge-leon
Copy link
Author

👍 Look forward to the PR

Hi uhurusurfa: please consider the attached patch, it's almost trivial, and my resources are bound. I have more enhancements with broader scope in preparation on which I'd like to focus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working or is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants