diff --git a/apps/auth/views.py b/apps/auth/views.py index 4e173b1b..77f3a37f 100644 --- a/apps/auth/views.py +++ b/apps/auth/views.py @@ -1,3 +1,5 @@ +import os + from uuid import uuid4 from urllib.parse import urlsplit @@ -182,7 +184,7 @@ class FacebookLoginOrRegistration(View): login(requests, user=user) return JsonResponse({"success": True}) else: - if not user.photo and photo_data: + if (not user.photo or (user.photo and not os.path.isfile(user.photo.path))) and photo_data: photo = ContentFile(photo_data) fname = str(fb_id) + '.jpg' user.photo.save(fname, photo, save=True)