Answer the question
In order to leave comments, you need to log in
Signing up from a third party app?
There is a local DJANGO
server, there is a registration form (default for creating a user)
located: 127.0.0.1:8000/users/register
Thanks in advance )
Answer the question
In order to leave comments, you need to log in
Send a post request to a url with data, and make a user according to this data?) Or is it a default URL? (then there will be a problem with csrf, like)
I just did it recently, registration from 1C
@method_decorator(csrf_exempt, name='dispatch')
class Registration(View):
def post(self, request, **kwargs):
data = json.loads(request.body)
if request.headers['Authorization'] != "Bearer TOKEN":
return HttpResponse("Unauthorized", status=401)
result = {
"result": True,
}
psw = passwordGenerator(10)
phone = phone_clean(data['phone'])
user, created = User.objects.get_or_create(
username=phone,
first_name=data['first_name'],
last_name=data['last_name'],
)
if created:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question