예제 #1
0
 def login(cls, login_info):
     test = security.hash_password({"password" : login_info['password']})
     s_info = user_svc.get_by_email(login_info['email'])
     if test == s_info['password'].encode():
         tok = security.generate_token(s_info)
         return tok
     else:
         return False
예제 #2
0
    def register(cls, data):

        hashed_pw = security.hash_password({"password" : data['password']})
        data["password"] = hashed_pw
        result = user_svc.create_user(data)
        s_info = user_svc.get_by_email(data['email'])
        tok = security.generate_token(s_info)
        return result, tok
예제 #3
0
def t1():

    r = UserService.get_by_email('*****@*****.**')
    print("Result = \n", json.dumps(r, indent=2))