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

Fix logout in Django 5 with POST action instead of GET #1181

Merged
merged 7 commits into from
May 9, 2024
Merged

Conversation

Benbb96
Copy link
Member

@Benbb96 Benbb96 commented May 7, 2024

@Benbb96 Benbb96 marked this pull request as ready for review May 7, 2024 13:51
helpdesk/urls.py Outdated
@@ -215,7 +215,7 @@ def get_context_data(self, **kwargs):
path(
"logout/",
auth_views.LogoutView.as_view(
template_name="helpdesk/registration/login.html", next_page="../"
template_name="helpdesk/registration/login.html", next_page=reverse_lazy("helpdesk:home")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the template_name does not seem to be useful when we provide next_page.
Moreover, there is a template for the confirmation of logging out, but it's not called anywhere. I believe it would make more sense to point to it instead of login page.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed - go ahead and change the logout next page to the confirmation of logout page.

Copy link
Collaborator

@uhurusurfa uhurusurfa May 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally the logged out page needs a link to go back to the login page otherwise the user who is security concious and logs out regularly has to change the URL or use a bookmark.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, here's what I have now for the logged_out page :

image

What do you think?

A login button is available in the header so it might not be needed to show it again.

Copy link
Collaborator

@uhurusurfa uhurusurfa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@uhurusurfa
Copy link
Collaborator

Awesome - much better flow

@uhurusurfa uhurusurfa merged commit d7b7508 into main May 9, 2024
8 checks passed
@uhurusurfa uhurusurfa deleted the fix-logout branch May 9, 2024 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

logout stops working with Django >4.0
2 participants