From 4a2ea7441043a935582cfb681fa84c8e9134f5b0 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Tue, 10 Jul 2012 22:20:20 +0100 Subject: [PATCH] Add the ability to search by Service UID, resolves #272 --- app/sso/forms.py | 3 ++- app/sso/views.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/sso/forms.py b/app/sso/forms.py index 16fdd09..2141696 100644 --- a/app/sso/forms.py +++ b/app/sso/forms.py @@ -99,7 +99,8 @@ class UserLookupForm(forms.Form): choices = [(1, "Auth Username"), (2, "Character"), (4, "Email Address"), - (5, "EVE API Key ID"), ] + (5, "EVE API Key ID"), + (6, "Service UID"),] if installed('reddit') and gargoyle.is_active('reddit', request): choices.append((3, "Reddit ID")) diff --git a/app/sso/views.py b/app/sso/views.py index 1746a76..9f63d87 100644 --- a/app/sso/views.py +++ b/app/sso/views.py @@ -226,6 +226,9 @@ def user_lookup(request): elif form.cleaned_data['type'] == '5': uids = EVEAccount.objects.filter(api_user_id__icontains=username).values_list('user', flat=True) users = User.objects.filter(id__in=uids).only('username') + elif form.cleaned_data['type'] == '6': + uids = ServiceAccount.objects.filter(service_uid__icontains=username).values_list('user', flat=True) + users = User.objects.filter(id__in=uids).only('username') else: messages.add_message(request, messages.ERROR, "Error parsing form, Type: %s, Value: %s" % (form.cleaned_data['type'], username)) return redirect('sso.views.user_lookup')