'Create the user\'s account.
You must send all required form fields with the request.
You can optionally send a "course_id" param to indicate in analytics
events that the user registered while enrolling in a particular course.
Arguments:
request (HTTPRequest)
Returns:
HttpResponse: 200 on success
HttpResponse: 400 if the request is not valid.
HttpResponse: 409 if an account with the given username or email
address already exists
HttpResponse: 403 operation not allowed'

@method_decorator(csrf_exempt)
def post(self, request):

    data = request.POST.copy()
    email = data.get('email')
    username = data.get('username')
    conflicts = check_account_exists(email=email, username=username)
    if conflicts:
        conflict_messages = {'email': accounts.EMAIL_CONFLICT_MSG.format(email_address=email), 'username': accounts.USERNAME_CONFLICT_MSG.format(username=username)}
        errors = {field: [{'user_message': conflict_messages[field]}] for field in conflicts}
        return JsonResponse(errors, status=409)
    if (data.get('honor_code') and ('terms_of_service' not in data)):
        data['terms_of_service'] = data['honor_code']
    try:
        user = create_account_with_params(request, data)
    except AccountValidationError as err:
        errors = {err.field: [{'user_message': err.message}]}
        return JsonResponse(errors, status=409)
    except ValidationError as err:
        assert (NON_FIELD_ERRORS not in err.message_dict)
        errors = {field: [{'user_message': error} for error in error_list] for (field, error_list) in err.message_dict.items()}
        return JsonResponse(errors, status=400)
    except PermissionDenied:
        return HttpResponseForbidden(_('Account    creation    not    allowed.'))
    response = JsonResponse({'success': True})
    set_logged_in_cookies(request, response, user)
    return response
