In order to fix the reoccuring issue that OpenID users have to add several different OpenID variations, we'll save the usual variations now in different digest fields -> should ease the pain a lot

This commit is contained in:
Oliver Falk
2020-02-25 14:37:03 +01:00
parent 94bd528be2
commit b11495d0b6
6 changed files with 123 additions and 6 deletions

View File

@@ -12,6 +12,7 @@ from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
from django.core.exceptions import ObjectDoesNotExist
from django.utils.translation import ugettext_lazy as _
from django.urls import reverse_lazy
from django.db.models import Q
from PIL import Image
@@ -109,7 +110,15 @@ class AvatarImageView(TemplateView):
except ObjectDoesNotExist:
model = ConfirmedOpenId
try:
obj = model.objects.get(digest=kwargs['digest'])
d = kwargs['digest']
# OpenID is tricky. http vs. https, versus trailing slash or not
# However, some users eventually have added their variations already
# and therfore we need to use filter() and first()
obj = model.objects.filter(
Q(digest=d) |
Q(alt_digest1=d) |
Q(alt_digest2=d) |
Q(alt_digest3=d)).first()
except:
pass