Skip to content

Commit

Permalink
fix: Fix Apple registration during migration (openedx#32893)
Browse files Browse the repository at this point in the history
  • Loading branch information
moeez96 authored Aug 2, 2023
1 parent f6a60cd commit df63305
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions common/djangoapps/third_party_auth/appleid.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,12 @@ def get_user_id(self, details, response):
# belonging to already signed-in users.
AppleMigrationUserIdInfo = apps.get_model('third_party_auth', 'AppleMigrationUserIdInfo')
user_apple_id_info = AppleMigrationUserIdInfo.objects.filter(transfer_id=transfer_sub).first()
old_apple_id = user_apple_id_info.old_apple_id
if social_django.models.DjangoStorage.user.get_social_auth(provider=self.name, uid=old_apple_id):
user_apple_id_info.new_apple_id = response.get(self.ID_KEY)
user_apple_id_info.save()
return user_apple_id_info.old_apple_id
if user_apple_id_info:
old_apple_id = user_apple_id_info.old_apple_id
if social_django.models.DjangoStorage.user.get_social_auth(provider=self.name, uid=old_apple_id):
user_apple_id_info.new_apple_id = response.get(self.ID_KEY)
user_apple_id_info.save()
return user_apple_id_info.old_apple_id

return apple_id

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def _exchange_transfer_id_for_new_apple_id(self, transfer_id):
new_apple_id = ''
except (requests.exceptions.JSONDecodeError, AttributeError):
log.info('JSONDecodeError/AttributeError for transfer_id %s.', transfer_id)
transfer_id = ''
new_apple_id = ''

return new_apple_id

Expand Down

0 comments on commit df63305

Please sign in to comment.