def post(self): value = parser.parse_args() user = UserModel.find_by_name(value.name) if user and safe_str_cmp(user.password, value.password): accessToken = create_access_token(identity=user.id, fresh=True) refreshToken = create_refresh_token(user.id) return { 'accessToken': accessToken, 'refreshToken': refreshToken, } return {'msg': 'invalid credential'}
def authenticate(username,password): users = UserModel.find_by_name(username) if users and safe_str_cmp(users.password,password): return users return {'msg':'no user'},400
def authenticate(username, password): user = UserModel.find_by_name(username) if user and safe_str_cmp(user.password, password): return user