def api_status(db): name = request.GET.get('name') or request.forms.get('name') or '' token = request.GET.get('token') or request.forms.get('token') or '' #print 'Name:', name, ',Token:', token ''' check login ''' tdb = TokenDB(db) ret = tdb.admin_check(name, token) if ret['status'] == False: response.content_type = 'application/json' return json.dumps({'status': False, 'data': 'need login'}) ''' get other info ''' return ret
def api_login(db): name = request.GET.get('name') or request.forms.get('name') or '' token = request.GET.get('token') or request.forms.get('token') or '' destroy_tokens = request.GET.get('destroy') or request.forms.get('destroy') or '' tdb = TokenDB(db) if destroy_tokens <> '': ret = tdb.admin_check(name, token) if ret['status']: ret = tdb.admin_token_destory_all(name) else: ret = tdb.admin_logout(name, token) response.content_type = 'application/json' return json.dumps(ret)
def api_status(db): name = request.GET.get('name') or request.forms.get('name') or '' token = request.GET.get('token') or request.forms.get('token') or '' #print 'Name:', name, ',Token:', token ''' check login ''' tdb = TokenDB(db) ret = tdb.admin_check(name, token) if ret['status'] == False: response.content_type = 'application/json' return json.dumps({'status':False,'data':'need login'}) ''' get other info ''' return ret
def api_login(db): name = request.GET.get('name') or request.forms.get('name') or '' token = request.GET.get('token') or request.forms.get('token') or '' destroy_tokens = request.GET.get('destroy') or request.forms.get( 'destroy') or '' tdb = TokenDB(db) if destroy_tokens <> '': ret = tdb.admin_check(name, token) if ret['status']: ret = tdb.admin_token_destory_all(name) else: ret = tdb.admin_logout(name, token) response.content_type = 'application/json' return json.dumps(ret)
def api_change_password(db): name = request.GET.get('name', '').strip() token = request.GET.get('token', '').strip() password = request.GET.get('password', '') if password == '' or token == '' or name == '': response.content_type = 'application/json' return json.dumps({'status': False}) ''' check login ''' tdb = TokenDB(db) ret = tdb.admin_check(name, token) if ret['status'] == False: response.content_type = 'application/json' return json.dumps({'status': False, 'data': 'need login'}) ''' change password ''' ret = tdb.admin_change_password(name, password) response.content_type = 'application/json' return json.dumps(ret)
def api_change_password(db): name = request.GET.get('name', '').strip() token = request.GET.get('token', '').strip() password = request.GET.get('password', '') if password == '' or token == '' or name == '': response.content_type = 'application/json' return json.dumps({'status':False}) ''' check login ''' tdb = TokenDB(db) ret = tdb.admin_check(name, token) if ret['status'] == False: response.content_type = 'application/json' return json.dumps({'status':False,'data':'need login'}) ''' change password ''' ret = tdb.admin_change_password(name, password) response.content_type = 'application/json' return json.dumps(ret)