fix validation rules so description_hash works.
This commit is contained in:
@@ -36,7 +36,7 @@ def api_validate_post_request(*, schema: dict):
|
||||
return jsonify({"message": "Content-Type must be `application/json`."}), HTTPStatus.BAD_REQUEST
|
||||
|
||||
v = Validator(schema)
|
||||
g.data = {key: (request.json[key] if key in request.json else None) for key in schema.keys()}
|
||||
g.data = {key: request.json[key] for key in schema.keys() if key in request.json}
|
||||
|
||||
if not v.validate(g.data):
|
||||
return jsonify({"message": f"Errors in request data: {v.errors}"}), HTTPStatus.BAD_REQUEST
|
||||
@@ -56,7 +56,7 @@ def check_user_exists(param: str = "usr"):
|
||||
allowed_users = getenv("LNBITS_ALLOWED_USERS", "all")
|
||||
|
||||
if allowed_users != "all" and g.user.id not in allowed_users.split(","):
|
||||
abort(HTTPStatus.UNAUTHORIZED, f"User not authorized.")
|
||||
abort(HTTPStatus.UNAUTHORIZED, "User not authorized.")
|
||||
|
||||
return view(**kwargs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user