mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Added the ability to search by EVE API User ID
This commit is contained in:
@@ -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"))
|
||||
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user