return default user
This commit is contained in:
parent
1e05da5689
commit
e866cdf010
1 changed files with 4 additions and 1 deletions
|
@ -98,6 +98,9 @@ def api_logout(request):
|
||||||
if request.user.is_authenticated():
|
if request.user.is_authenticated():
|
||||||
response = json_response(text='logged out')
|
response = json_response(text='logged out')
|
||||||
logout(request)
|
logout(request)
|
||||||
|
with open(os.path.join(settings.PROJECT_ROOT, 'templates', 'site.json')) as f:
|
||||||
|
site = json.load(f)
|
||||||
|
response['data']['user'] = site['user']
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
actions.register(api_logout, 'logout')
|
actions.register(api_logout, 'logout')
|
||||||
|
|
||||||
|
@ -303,7 +306,7 @@ def findUser(request):
|
||||||
data = json.loads(request.POST['data'])
|
data = json.loads(request.POST['data'])
|
||||||
response = json_response(status=200, text='ok')
|
response = json_response(status=200, text='ok')
|
||||||
if data['key'] == 'email':
|
if data['key'] == 'email':
|
||||||
response['data']['emails'] = [u.username for u in User.objects.filter(email__iexact=data['value'])]
|
response['data']['users'] = [u.email for u in User.objects.filter(email__iexact=data['value'])]
|
||||||
else:
|
else:
|
||||||
response['data']['users'] = [u.username for u in User.objects.filter(username__iexact=data['value'])]
|
response['data']['users'] = [u.username for u in User.objects.filter(username__iexact=data['value'])]
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
|
|
Loading…
Reference in a new issue