Skip to content

Commit 2e740dc

Browse files
committed
Two changes: (1) searches by substring rather than
"begins with" (to allow, e.g., searching by last name); and (2) limits results to 10 entries (to limit server load and limit effectiveness of email-scraping attacks) - Legacy-Id: 5519
1 parent ab5b610 commit 2e740dc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ietf/person/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
from ietf.person.forms import json_emails
55

66
def ajax_search_emails(request):
7-
emails = Email.objects.filter(person__alias__name__istartswith=request.GET.get('q','')).order_by('person__name').distinct()
7+
emails = Email.objects.filter(person__alias__name__icontains=request.GET.get('q','')).filter(active='true').order_by('person__name').distinct()[:10]
88
return HttpResponse(json_emails(emails), mimetype='application/json')

0 commit comments

Comments
 (0)