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

Log out via POST #1287

Open
chris34 opened this issue Jan 6, 2024 · 0 comments
Open

Log out via POST #1287

chris34 opened this issue Jan 6, 2024 · 0 comments

Comments

@chris34
Copy link
Member

chris34 commented Jan 6, 2024

Even if we dont use django's logout views, we should change to logout via POST (no problem with CSRF)

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

Logging out via GET requests to the built-in logout view is deprecated. Use POST requests instead.

If you want to retain the user experience of an HTML link, you can use a form that is styled to appear as a link:

<form id="logout-form" method="post" action="{% url 'admin:logout' %}">
  {% csrf_token %}
  <button type="submit">{% translate "Log out" %}</button>
</form>
#logout-form {
  display: inline;
}
#logout-form button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
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

No branches or pull requests

1 participant