diff options
author | Frederick Muriuki Muriithi | 2024-07-26 17:07:54 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-07-26 17:07:54 -0500 |
commit | 0c58a993a619e658761818198ef2e8f64f12393d (patch) | |
tree | 60bf246bbe32b0b256e1334792f9b56e4638c91d | |
parent | 39c1bfae9d282b82c729a21718e9a964d93b4574 (diff) | |
download | genenetwork2-0c58a993a619e658761818198ef2e8f64f12393d.tar.gz |
Use JSON rather than X-Form-URL-encoded data with auth server.
-rw-r--r-- | gn2/wqflask/oauth2/groups.py | 8 | ||||
-rw-r--r-- | gn2/wqflask/oauth2/resources.py | 4 | ||||
-rw-r--r-- | gn2/wqflask/oauth2/toplevel.py | 2 | ||||
-rw-r--r-- | gn2/wqflask/oauth2/users.py | 4 |
4 files changed, 9 insertions, 9 deletions
diff --git a/gn2/wqflask/oauth2/groups.py b/gn2/wqflask/oauth2/groups.py index e4028497..b3f1f54d 100644 --- a/gn2/wqflask/oauth2/groups.py +++ b/gn2/wqflask/oauth2/groups.py @@ -44,7 +44,7 @@ def create_group(): def __setup_group__(response): session["user_details"]["group"] = response - resp = oauth2_post("auth/group/create", data=dict(request.form)) + resp = oauth2_post("auth/group/create", json=dict(request.form)) return resp.either( handle_error("oauth2.group.join_or_create"), handle_success( @@ -116,7 +116,7 @@ def accept_join_request(): return redirect(url_for("oauth2.group.list_join_requests")) return oauth2_post( "auth/group/requests/join/accept", - data=request.form).either( + json=dict(request.form)).either( handle_error("oauth2.group.list_join_requests"), __success__) @@ -132,7 +132,7 @@ def reject_join_request(): return redirect(url_for("oauth2.group.list_join_requests")) return oauth2_post( "auth/group/requests/join/reject", - data=request.form).either( + json=dict(request.form)).either( handle_error("oauth2.group.list_join_requests"), __success__) @@ -163,7 +163,7 @@ def add_delete_privilege_to_role( } return oauth2_post( uris[direction], - data={ + json={ "group_role_id": group_role_id, "privilege_id": privilege_id }).either(__error__, __success__) diff --git a/gn2/wqflask/oauth2/resources.py b/gn2/wqflask/oauth2/resources.py index 66545802..b8d804f9 100644 --- a/gn2/wqflask/oauth2/resources.py +++ b/gn2/wqflask/oauth2/resources.py @@ -173,7 +173,7 @@ def link_data_to_resource(): flash(f"Data linked to resource successfully", "alert-success") return redirect(url_for( "oauth2.resource.view_resource", resource_id=resource_id)) - return oauth2_post("auth/resource/data/link", data=dict(form)).either( + return oauth2_post("auth/resource/data/link", json=dict(form)).either( __error__, __success__) except AssertionError as aserr: @@ -202,7 +202,7 @@ def unlink_data_from_resource(): return redirect(url_for( "oauth2.resource.view_resource", resource_id=resource_id)) return oauth2_post( - "auth/resource/data/unlink", data=dict(form)).either( + "auth/resource/data/unlink", json=dict(form)).either( __error__, __success__) except AssertionError as aserr: flash(aserr.args[0], "alert-danger") diff --git a/gn2/wqflask/oauth2/toplevel.py b/gn2/wqflask/oauth2/toplevel.py index 47b83ccf..210b0756 100644 --- a/gn2/wqflask/oauth2/toplevel.py +++ b/gn2/wqflask/oauth2/toplevel.py @@ -81,7 +81,7 @@ def authorisation_code(): return redirect("/") return no_token_post( - "auth/token", data=request_data).either( + "auth/token", json=request_data).either( lambda err: __error__(process_error(err)), __success__) flash("AuthorisationError: No code was provided.", "alert-danger") return redirect("/") diff --git a/gn2/wqflask/oauth2/users.py b/gn2/wqflask/oauth2/users.py index 520a13c5..7d9186ab 100644 --- a/gn2/wqflask/oauth2/users.py +++ b/gn2/wqflask/oauth2/users.py @@ -67,7 +67,7 @@ def request_add_to_group() -> Response: return redirect(url_for("oauth2.user.user_profile")) return oauth2_post(f"auth/group/requests/join/{group_id}", - data=form).either(__error__, __success__) + json=form).either(__error__, __success__) @users.route("/logout", methods=["GET", "POST"]) @@ -108,7 +108,7 @@ def register_user(): form = request.form response = requests.post( urljoin(authserver_uri(), "auth/user/register"), - data = { + json = { "user_name": form.get("user_name"), "email": form.get("email_address"), "password": form.get("password"), |