Hi,
Log out via GET requests is deprecated from Django 4.1 and will be removed in Django 5.0. I have a view where the user has to be logged in (otherwise it redirects to login), and then I check if the user logged in is not the correct user, and if they are different - I redirect the user to logout (via GET), which should then be redirected again to login, and then redirected to the same view:
from django.views import generic
from django.views.generic.detail import SingleObjectMixin
from rules.contrib.views import LoginRequiredMixin, PermissionRequiredMixin
class VerifyUserEmailAddressView(LoginRequiredMixin, SingleObjectMixin, generic.View):
...
def get(self, request, *args, **kwargs):
email_address = self.get_object()
if (not (email_address.user == self.request.user)):
return redirect(to='{}?next={}'.format(reverse('accounts:logout'), self.request.get_full_path()))
assert (email_address.user == self.request.user)
...
Now, what should I do instead of redirecting the user to logout view? How do I implement it with POST?