introduce the isRegistered key for registered users

This commit is contained in:
Davide Alberani 2017-02-20 21:30:41 +01:00
parent d8e6a8cd5b
commit 44ebdcaa08

View file

@ -87,9 +87,8 @@ class BaseHandler(tornado.web.RequestHandler):
:type data: dict""" :type data: dict"""
if isinstance(data, dict): if isinstance(data, dict):
for key in list(data.keys()): for key in list(data.keys()):
if (isinstance(key, str) and key.startswith('$')) or key in ('_id', 'created_by', if (isinstance(key, str) and key.startswith('$')) or key in ('_id', 'created_by', 'created_at',
'created_at', 'updated_by', 'updated_by', 'updated_at', 'isRegistered'):
'updated_at'):
del data[key] del data[key]
return data return data
@ -135,6 +134,7 @@ class BaseHandler(tornado.web.RequestHandler):
user = self.db.getOne('users', {'_id': user_info['_id']}) user = self.db.getOne('users', {'_id': user_info['_id']})
if user: if user:
user_info = user user_info = user
user_info['isRegistered'] = True
self._users_cache[current_user] = user_info self._users_cache[current_user] = user_info
return user_info return user_info