From 079be0bb46362d7ba3b178e37617bc96e15bc74c Mon Sep 17 00:00:00 2001 From: starnakin Date: Mon, 11 Dec 2023 12:43:49 +0100 Subject: [PATCH] delete accounts auto logout --- accounts/views/delete.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/accounts/views/delete.py b/accounts/views/delete.py index 30b4c7c..9a83800 100644 --- a/accounts/views/delete.py +++ b/accounts/views/delete.py @@ -1,6 +1,7 @@ from rest_framework.views import APIView from rest_framework import permissions, status from rest_framework.response import Response +from django.contrib.auth import logout from django.http import HttpRequest from rest_framework.authentication import SessionAuthentication @@ -16,4 +17,5 @@ class DeleteView(APIView): if (request.user.check_password(password) == False): return Response({"password": ["Password wrong."]}) request.user.delete() + logout(request) return Response("user deleted", status=status.HTTP_200_OK) \ No newline at end of file