Exemplo n.º 1
0
 def post(self):
   if not referer(): return "",404
   data = postData()
   if 'token' in data.keys(): #and 'jti' in data.keys():
     from util.myjwt import refreshToken 
     return refreshToken(refresh=data['token']) #,tokenid=data['jti'])
   else:  return json.dumps({"status":"fail1"})
Exemplo n.º 2
0
 def post(self):
   data = postData()
   if 'nickname' in data.keys() and 'email' in data.keys() and 'password' in data.keys():
     from util.password import hash_password
     password= hash_password(data['password'])
     return doIt(insertUser(nickname=data['nickname'],email=data['email'], password=password) )
     #return doIt(insertUser(nickname=data['nickname'],email=data['email'], password=data['password']) )
   else:  return json.dumps({"status":"fail1"})
Exemplo n.º 3
0
 def post(self):
     data = postData()
     if 'id' in data.keys() and 'password' in data.keys():
         if (delete(id=data['id'], password=data['password'])):
             return json.dumps({"status": "success"})
         else:
             return json.dumps({"status": "fail2"})
     else:
         return json.dumps({"status": "fail1"})
Exemplo n.º 4
0
 def post(self):
     data = postData()
     print(data)
     print(data.keys())
     #print(data)
     #print(data.keys())
     if 'nickname' in data.keys() and 'password' in data.keys(
     ) and 'title' in data.keys() and 'contents' in data.keys():
         if insert(nickname=data['nickname'],
                   password=data['password'],
                   title=data['title'],
                   contents=data['contents']):
             return json.dumps({"status": "success"})
         else:
             return json.dumps({"status": "fail2"})
     else:
         return json.dumps({"status": "fail1"})
Exemplo n.º 5
0
 def post(self):
   if not referer(): return "",404
   data = postData()
   if 'email' in data.keys() and 'password' in data.keys():
     data2 = loginUser(email=data['email'])
     #print(json.dumps(data2))
     from util.password import check_password
     if check_password(password=data['password'], password2=data2['password']):
         from util.myjwt import makeToken
         import uuid
         tokenId = str(uuid.uuid4())
         accessToken = makeToken(tokenId=tokenId, tokenType='access', nickname=data2['nickname'],accountid=data2['accountid'] ).decode('utf-8')
         refreshToken = makeToken(tokenId=tokenId, tokenType='refresh', nickname=data2['nickname'],accountid=data2['accountid'] ).decode('utf-8')
   
         return json.dumps({"accessToken":accessToken, "refreshToken":refreshToken})
     else:  return json.dumps({"status":"fail2"})
   
   else:  return json.dumps({"status":"fail1"})
Exemplo n.º 6
0
 def post(self):
   data = postData()
   if 'email' in data.keys():
     return doIt(checkEmail(email=data['email']))
   else:  return json.dumps({"status":"fail1"})