Login new users only for non-SCA generic subscription payments only
This commit is contained in:
parent
968eaaf6a4
commit
eefabe45b6
1 changed files with 7 additions and 9 deletions
|
@ -1039,16 +1039,13 @@ class OrderConfirmationView(DetailView, FormView):
|
||||||
template, request.session.get('billing_address_data'),
|
template, request.session.get('billing_address_data'),
|
||||||
self.request
|
self.request
|
||||||
)
|
)
|
||||||
try:
|
|
||||||
custom_user = CustomUser.objects.get(email=user.get('email'))
|
|
||||||
login(self.request, custom_user)
|
|
||||||
except (CustomUser.DoesNotExist,
|
|
||||||
CustomUser.MultipleObjectsReturned) as ex:
|
|
||||||
logger.error(str(ex))
|
|
||||||
|
|
||||||
if (provisioning_response and
|
if (provisioning_response and
|
||||||
type(provisioning_response) == JsonResponse):
|
type(provisioning_response['response']) == JsonResponse):
|
||||||
return provisioning_response
|
new_user = provisioning_response.get('user', None)
|
||||||
|
if new_user:
|
||||||
|
login(self.request, new_user)
|
||||||
|
return provisioning_response['response']
|
||||||
|
|
||||||
response = {
|
response = {
|
||||||
'status': True,
|
'status': True,
|
||||||
|
@ -1103,6 +1100,7 @@ def do_provisioning(request, user, stripe_api_cus_id, card_details_response,
|
||||||
"""
|
"""
|
||||||
# Create user if the user is not logged in and if he is not already
|
# Create user if the user is not logged in and if he is not already
|
||||||
# registered
|
# registered
|
||||||
|
new_user = None
|
||||||
try:
|
try:
|
||||||
custom_user = CustomUser.objects.get(
|
custom_user = CustomUser.objects.get(
|
||||||
email=user.get('email'))
|
email=user.get('email'))
|
||||||
|
@ -1299,7 +1297,7 @@ def do_provisioning(request, user, stripe_api_cus_id, card_details_response,
|
||||||
}
|
}
|
||||||
logger.debug("after response")
|
logger.debug("after response")
|
||||||
logger.debug(str(response))
|
logger.debug(str(response))
|
||||||
return JsonResponse(response)
|
return {'response': JsonResponse(response), 'user': new_user}
|
||||||
|
|
||||||
user = {
|
user = {
|
||||||
'name': custom_user.name,
|
'name': custom_user.name,
|
||||||
|
|
Loading…
Reference in a new issue