Esempio n. 1
0
def testInsertUser():
    user = model.userinfo()
    user.account = "test2"
    user.password = "******"
    user.leftCount = 1000
    user.calledCount = 2
    addUser(user)
Esempio n. 2
0
 def POST(self):
     i = web.input()
     if ' ' in i.username or '/' in i.username or '\\' in i.username:
         return "<script type=\"text/javascript\" charset=”utf-8″> alert(\"\u7528\u6237\u540d\u4e0d\u80fd\u6709\u7a7a\u683c\u6216\u7279\u6b8a\u5b57\u7b26\"); \
         window.location.href=\"regbyadmin\"; </script>"
     #cap = web.config.session_parameters['capctha']
     #print(cap)
     '''if cap.lower() != i.captcha.lower():
         return "<script type=\"text/javascript\" charset=”utf-8″> alert(\"\u9a8c\u8bc1\u7801\u8f93\u5165\u9519\u8bef\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\uff01\"); \
         window.location.href=\"regbyadmin\"; </script>"'''
     if i.password != i.confirmPassword:
         return "<script type=\"text/javascript\" charset=”utf-8″> alert(\"\u4e24\u6b21\u8f93\u5165\u7684\u5bc6\u7801\u4e0d\u4e00\u81f4\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\"); \
         window.location.href=\"regbyadmin\"; </script>"
     #if ' ' in i.username:
     #    
     myvar = dict(account=i.username)
     results = config.DB.select('userinfo', myvar, where="account = $account")
     if(len(results) != 0):
         return "<script type=\"text/javascript\" charset=”utf-8″> alert(\"\u8be5\u7528\u6237\u540d\u5df2\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\"); \
         window.location.href=\"regbyadmin\"; </script>"
     pwdhash = hashlib.md5(i.password).hexdigest()
     user = model.userinfo(i.username, pwdhash, 0, 0, 0, -1, token=uuid.uuid1())
     db.addUser(user)
     #n = config.DB.insert('userinfo', account=i.username, password=pwdhash, leftCount = 0, calledCount = 0, regTime=datetime.datetime.utcnow())
     return "<script type=\"text/javascript\"> alert(\"\u6ce8\u518c\u6210\u529f\"); \
Esempio n. 3
0
 def POST(self):
     ID = getCookieID()
     if ID == None:
         return web.seeother('login')
     '''
     cap = web.config.session_parameters['capctha']
     if cap.lower() != i.captcha.lower():
         return "<script type=\"text/javascript\" charset=”utf-8″> alert(\"\u9a8c\u8bc1\u7801\u8f93\u5165\u9519\u8bef\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\uff01\"); \
         window.location.href=\"addsubuserpage\"; </script>"
     print(cap)
     '''
   #  res=config.DB.select('userinfo', myvar, where="ID = $ID and STATUS=0")
   # if(len(res)==0):
   #      return "<script type=\"text/javascript\" charset=?.tf-8?? alert(\"\u8d26\u53f7\u5df2\u88ab\u5c01\"); \
   #      window.location.href=\"addsubuserpage\"; </script>"
     i = web.input()
     if len(i.account) == 0:
         return "<script type=\"text/javascript\" charset=”utf-8″> alert(\"\u7528\u6237\u540d\u957f\u5ea6\u4e0d\u80fd\u4e3a0\uff01\"); \
             window.location.href=\"addsubuserpage\"; </script>"
     if ' ' in i.account or '/' in i.account or '\\' in i.account:
         return "<script type=\"text/javascript\" charset=”utf-8″> alert(\"\u7528\u6237\u540d\u4e0d\u80fd\u6709\u7a7a\u683c\u6216\u7279\u6b8a\u5b57\u7b26\"); \
             window.location.href=\"addsubuserpage\"; </script>"
     if i.password != i.confirmPassword:
         return "<script type=\"text/javascript\" charset=”utf-8″> alert(\"\u4e24\u6b21\u8f93\u5165\u7684\u5bc6\u7801\u4e0d\u4e00\u81f4\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\"); \
         window.location.href=\"addsubuserpage\"; </script>"
     myvar = dict(account=i.account)
     results = config.DB.select('userinfo', myvar, where="account = $account")
     if(len(results) != 0):
         return "<script type=\"text/javascript\" charset=”utf-8″> alert(\"\u8be5\u7528\u6237\u540d\u5df2\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\"); \
         window.location.href=\"addsubuserpage\"; </script>"
     myvar = dict(account=i.account, ID=ID)
     results = config.DB.select('userinfo', myvar, where="account = $account and PARENTID=$ID")
     if(len(results) != 0):
         return "<script type=\"text/javascript\" charset=”utf-8″> alert(\"\u8be5\u7528\u6237\u540d\u5df2\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\"); \
         window.location.href=\"addsubuserpage\"; </script>"
     #addSubUser(i.account, )
     pwdhash = hashlib.md5(i.password).hexdigest()
     user = model.userinfo(i.account, pwdhash, 0, 0, 0, ID)
     db.addSubUser(user)
     return "<script type=\"text/javascript\"> alert(\"\u6ce8\u518c\u6210\u529f\"); \
Esempio n. 4
0
def modSubUser(id,username,passwd,count,leftcount,succount):
    pwdhash = hashlib.md5(passwd).hexdigest()
    user = model.userinfo(id, username, pwdhash, leftcount, succount, 0)
    db.modSubUser(user)
Esempio n. 5
0
def addSubUser(username,passwd,count,parentid):
	pwdhash = hashlib.md5(passwd).hexdigest()
	user = model.userinfo(username, pwdhash, count, 0, 0,parentid)
	db.addSubUser(user)
Esempio n. 6
0
def querySubUser(username):
    user = model.userinfo(0,username, '', 0, 0, 0,-1)
    users = db.querySubUser(user)
    return users