delete accounts auto logout
This commit is contained in:
parent
df436e0b88
commit
079be0bb46
@ -1,6 +1,7 @@
|
|||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from rest_framework import permissions, status
|
from rest_framework import permissions, status
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
|
from django.contrib.auth import logout
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
from rest_framework.authentication import SessionAuthentication
|
from rest_framework.authentication import SessionAuthentication
|
||||||
|
|
||||||
@ -16,4 +17,5 @@ class DeleteView(APIView):
|
|||||||
if (request.user.check_password(password) == False):
|
if (request.user.check_password(password) == False):
|
||||||
return Response({"password": ["Password wrong."]})
|
return Response({"password": ["Password wrong."]})
|
||||||
request.user.delete()
|
request.user.delete()
|
||||||
|
logout(request)
|
||||||
return Response("user deleted", status=status.HTTP_200_OK)
|
return Response("user deleted", status=status.HTTP_200_OK)
|
Loading…
Reference in New Issue
Block a user