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?
Thanks,
אורי
[email protected]
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CABD5YeE0c%2B17cUgiU2tLp7L0zFjEfTVmJ6B3KvkwEftvGsuQBw%40mail.gmail.com.