Пример #1
0
 def __init__(self, db=RUtils.RDateBasePool().begin(), token=None):
     self.config = RUtils.RConfig()
     self.info = UserInfo()
     self.db = db
     self.session = RUtils.RMemorySessionStore()
     if token:
         self.info.token = token
         self.login_by_token()
Пример #2
0
 def on_get(self, req, resp):
     if 'password' not in req.params.keys():
         raise RUtils.RError(2)
     if req.params['password'] != RUtils.RConfig().password:
         raise RUtils.RError(2)
     data = self.db.students.find({})
     result = []
     for i in data:
         result.append({
             'id': str(i['_id']),
             'name': i['name'],
             'phone': i['phone'],
             'email': i['email'],
             'academy': i['academy'],
             'wechat': i['wechat'],
             'arrive_date': i['arrive_date'],
             'leave_date': i['leave_date'],
             'job': i['job'],
             'special': i['special'],
             'register_time': i['register_time']
         })
     req.context['result'] = result
Пример #3
0
 def __init__(self, client):
     self.client = client
     self.db = self.client.comic
     self.config = RUtils.RConfig()
Пример #4
0
def hash_password(password):
    return hashlib.sha512(password +
                          RUtils.RConfig().password_salt).hexdigest()[0:64]