def user_regester(username, password, phone=''): from core import CMS setting = CMS.setting_info('system') if 'regester_admin' in setting.keys(): setting = setting['regester_admin'] from core.user import User login = CMS( User(ident=setting['username'], pwd=setting['password'])) is_regester = login.UserMod().create(username, password, phone) if not is_regester['success']: raise Exception('Unknow error cant create user') return {'success': True} else: raise Exception('setup regester fuc first!')
def setup_regester_fuc(self): from core import CMS import random username = "".join(random.sample(ran_char, 16)) password = "".join(random.sample(ran_char, 16)) core = CMS(self.user) is_create = core.UserMod().create(username=username, password=password, group='admin') if not is_create['success']: raise Exception('Unknow error cant create regester admin') is_setup = core.Setting_setup().fix_one( {'set_type': 'system'}, {'regester_admin': dict(username=username, password=password)}) if not is_setup: raise Exception('Unknow error cant setup setting regester admin') return {'success': True}
# "headimg": "", # "belong": "KFC" }, "status": { # "score": {}, "device_info": { "id": "123456" } } } if __name__ == '__main__': # for n in range(15): # print n, # test_content(num=str(n)) # test_user() # super.user.info_update(info) # test_user('abcdefg', 'abcdefg123') # user = CMS(User(ident='abcdefg', pwd='abcdefg123')) # user.user.info_update(info) # import json # print json.dumps(info) # super.PermissionMod().grant('abcdefg', 'ContentMod#insert', ['1-1', '1-2']) # program_size() # print super.all_func print super.UserMod().create('rhewitt26654', 'ffwfafsdfas', phone='15265983264', group="user") pass