diff --git a/sso/forms.py b/sso/forms.py index 24c6abc..1e7105c 100644 --- a/sso/forms.py +++ b/sso/forms.py @@ -91,15 +91,12 @@ class ServiceAccountResetForm(forms.Form): class UserLookupForm(forms.Form): """ User Lookup Form """ - choices = [(1, "Auth Username"), - (2, "Character"), - (4, "Email Address"), ] - def __init__(self, *args, **kwargs): super(UserLookupForm, self).__init__(*args, **kwargs) choices = [(1, "Auth Username"), (2, "Character"), - (4, "Email Address"), ] + (4, "Email Address"), + (5, "EVE API User ID"), ] if installed('reddit'): choices.append((3, "Reddit ID")) diff --git a/sso/views.py b/sso/views.py index 4e3e0ed..fe75905 100644 --- a/sso/views.py +++ b/sso/views.py @@ -195,6 +195,9 @@ def user_lookup(request): users = User.objects.filter(id__in=uids).only('username') elif form.cleaned_data['type'] == '4': users = User.objects.filter(email__icontains=form.cleaned_data['username']).only('username') + elif form.cleaned_data['type'] == '5': + uids = EVEAccount.objects.filter(id__icontains=form.cleaned_data['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'], form.cleaned_data['username'])) return redirect('sso.views.user_lookup')