mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-16 21:18:02 +00:00
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user