1 # This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
4 from allauth.socialaccount.models import SocialAccount
5 from django.core.management.base import BaseCommand
9 'facebook': ['link', 'name', 'id', 'locale', 'timezone', 'updated_time', 'verified'],
10 'google': ['name', 'picture', 'locale', 'id', 'verified_email', 'link'],
14 class Command(BaseCommand):
15 def handle(self, *args, **options):
16 for provider, kept_fields in KEPT_FIELDS.items():
17 for sa in SocialAccount.objects.filter(provider=provider):
18 trimmed_data = {k: v for k, v in sa.extra_data.items() if k in kept_fields}
19 sa.extra_data = trimmed_data