fix: Fix Apple registration during migration (#32893)

This commit is contained in:
Moeez Zahid
2023-08-02 13:22:53 +05:00
committed by GitHub
parent f6a60cdc1c
commit df63305e24
2 changed files with 7 additions and 6 deletions

View File

@@ -228,11 +228,12 @@ class AppleIdAuth(BaseOAuth2):
# 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

View File

@@ -151,7 +151,7 @@ class Command(BaseCommand):
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