Exemple #1
0
    def POST(self):
        data = web.input()
        mpwd = hashlib.md5(data.password.strip()).hexdigest()
        user = db.manage.find_one({'username':data.username.strip(), 'password':mpwd})
        
        if user is None:
            return base.rtjson(100001)
        else:
            session.token = 'xqit'

        return base.rtjson()
Exemple #2
0
    def POST(self):
        data = web.input()
        mpwd = hashlib.md5(data.password.strip()).hexdigest()
        user = db.manage.find_one({
            'username': data.username.strip(),
            'password': mpwd
        })

        if user is None:
            return base.rtjson(100001)
        else:
            session.token = 'xqit'

        return base.rtjson()
Exemple #3
0
    def POST(self):
        data = web.input()
        m = hashlib.md5(data.oldPwd)
        password = m.hexdigest()
        user = db.manage.find_one({'username':'******'})

        if user['password'] != password:
            return base.rtjson(20012)
        else:
            m = hashlib.md5(data.newPwd.strip())
            newPwd = m.hexdigest()
            print newPwd
            db.manage.update({'username':'******'}, {'$set' : {'password' :newPwd}})
            return base.rtjson()
Exemple #4
0
 def POST(self):
     data = web.input()
     pipe.hset(rdbKey.globalHash(), 'amc', data.amc)
     pipe.hset(rdbKey.globalHash(), 'pmc', data.pmc)
     pipe.hset(rdbKey.globalHash(), 'wju', data.wju)
     pipe.execute()
     return base.rtjson()
Exemple #5
0
 def POST(self):
     data = web.input()
     pipe.hset(rdbKey.globalHash(), 'amc', data.amc)
     pipe.hset(rdbKey.globalHash(), 'pmc', data.pmc)
     pipe.hset(rdbKey.globalHash(), 'wju', data.wju)
     pipe.execute()
     return base.rtjson()
Exemple #6
0
    def POST(self):
        data = web.input()
        m = hashlib.md5(data.oldPwd)
        password = m.hexdigest()
        user = db.manage.find_one({'username': '******'})

        if user['password'] != password:
            return base.rtjson(20012)
        else:
            m = hashlib.md5(data.newPwd.strip())
            newPwd = m.hexdigest()
            print newPwd
            db.manage.update({'username': '******'},
                             {'$set': {
                                 'password': newPwd
                             }})
            return base.rtjson()
Exemple #7
0
 def POST(self):
     data = web.input()
     user = {
           '_id':base.getLastID('test'),
           'username':data.username,
           'pwd':data.pwd
           }
     db.test.insert(user)
     return base.rtjson(user=user)
Exemple #8
0
 def intercept(self, nextIntercept):
     if session.get('token') == 'xqit':
         return nextIntercept()
     else:
         environ = web.ctx.environ
         if environ.get('HTTP_X_REQUESTED_WITH') is None:
             raise web.seeother('/mlogin?call=' + web.ctx.path)
         else:
             return base.rtjson(20001, call=web.ctx.path)
Exemple #9
0
 def POST(self):
     data = web.input()
     user = {
         '_id': base.getLastID('test'),
         'username': data.username,
         'pwd': data.pwd
     }
     db.test.insert(user)
     return base.rtjson(user=user)
Exemple #10
0
 def intercept(self, nextIntercept):
     if session.get('uid') is None:
         environ = web.ctx.environ
         if environ.get('HTTP_X_REQUESTED_WITH') is None:
             raise web.seeother('/login?h=' + web.ctx.path)
         else:
             return base.rtjson(20001, redict=web.ctx.path)
     else:
         return nextIntercept()
Exemple #11
0
 def POST(self):
     bbs = db.GB.find()
     if len(list(bbs)) > 0:
         return base.rtjson(msg='done')
     
     fl = open(config.pp + "resource/bible/GB.txt")
     bbs = []
     for line in fl:
         ll = line.split(' ')
         Chapter = ll[1].split(':')
         index = int(Chapter[0]) * 1000 + int(Chapter[1])
         bb = {
             'book':ll[0],
             'index':index,
             'text':ll[1] + ' ' + ll[2]
             }
         bbs.append(bb)
     db.GB.insert(bbs)
     return base.rtjson()
Exemple #12
0
 def POST(self):
     data = web.input()
     upload_dir = UPLOAD_DIR + data.get('dir', 'temp') + '/'
     filePath = upload_dir + data.get('fname', tools.uniqueName()) + data.Filename[data.Filename.find('.'):]
     
     fileDir = filePath[:filePath.rfind('/')]
     if not os.path.exists(fileDir):os.makedirs(fileDir)
     
     fout = open(filePath, 'wb')
     fout.write(data.Filedata)
     fout.close()
     return base.rtjson(url='/' + filePath, state='SUCCESS')