From 53ad0d4d011641ce8813a731ca7a52199f76ba3a Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 25 Dec 2010 09:49:37 +0530 Subject: [PATCH] check emails --- pandora/user/views.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pandora/user/views.py b/pandora/user/views.py index c7921919a..5a0299a1a 100644 --- a/pandora/user/views.py +++ b/pandora/user/views.py @@ -33,7 +33,7 @@ def api_login(request): } return { - status: {'code': int, 'text': string} + status: {'code': 200, 'text': 'ok'} data: { errors: { username: 'Unknown Username', @@ -87,6 +87,11 @@ def api_logout(request): return { status: {'code': int, 'text': string} + data: { + user: { + default user + } + } } ''' response = json_response(text='ok') @@ -297,7 +302,10 @@ def findUser(request): #FIXME: support other operators and keys data = json.loads(request.POST['data']) response = json_response(status=200, text='ok') - response['data']['users'] = [u.username for u in User.objects.filter(username__iexact=data['value'])] + if data['key'] == 'email': + response['data']['emails'] = [u.username for u in User.objects.filter(email__iexact=data['value'])] + else: + response['data']['users'] = [u.username for u in User.objects.filter(username__iexact=data['value'])] return render_to_json_response(response) actions.register(findUser)