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
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
def t1(): r = UserService.get_by_email('*****@*****.**') print("Result = \n", json.dumps(r, indent=2))