Answer the question
In order to leave comments, you need to log in
How to send user data in signal after user login?
Since my front and back exist separately from each other, I have a custom login function, here it is:
@csrf_exempt
def custom_login(request):
if request.method == 'POST':
data = json.loads(request.body)
user = authenticate(request, username=data['login'], password=data['password'])
request.user = user
if user is not None:
login(request, user)
return HttpResponse(User.get_full_name(user))
else:
return HttpResponse('None')
Answer the question
In order to leave comments, you need to log in
Create your signal
https://docs.djangoproject.com/en/2.1/topics/signa...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question