aboutsummaryrefslogtreecommitdiff
path: root/gn_auth/auth/authorisation/users
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-06-17 10:57:17 -0500
committerFrederick Muriuki Muriithi2024-06-17 10:57:17 -0500
commit03bbb4df4e7a6a6b0bbccfabe8a28b380d12bd80 (patch)
tree41981115fa36a1bf36ba56d012e45da3c69216af /gn_auth/auth/authorisation/users
parent9f1b11d2756010647051bf213ceed3f374524bbb (diff)
downloadgn-auth-03bbb4df4e7a6a6b0bbccfabe8a28b380d12bd80.tar.gz
Use the form's json attribute to retrieve sent data
The system uses JSON as the default communication format, so we use the form's json attribute to get any data sent.
Diffstat (limited to 'gn_auth/auth/authorisation/users')
-rw-r--r--gn_auth/auth/authorisation/users/views.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/gn_auth/auth/authorisation/users/views.py b/gn_auth/auth/authorisation/users/views.py
index 1d3b128..cc70d76 100644
--- a/gn_auth/auth/authorisation/users/views.py
+++ b/gn_auth/auth/authorisation/users/views.py
@@ -166,7 +166,7 @@ def register_user() -> Response:
__assert_not_logged_in__(conn)
try:
- form = request.form
+ form = request.json
email = validate_email(form.get("email", "").strip(),
check_deliverability=True)
password = validate_password(
@@ -204,7 +204,7 @@ def delete_verification_code(cursor, code: str):
@users.route("/verify", methods=["GET", "POST"])
def verify_user():
"""Verify users are not bots."""
- form = request.form
+ form = request.json
loginuri = redirect(url_for(
"oauth2.auth.authorise",
response_type=(request.args.get("response_type")
@@ -308,7 +308,7 @@ def list_all_users() -> Response:
@users.route("/handle-unverified", methods=["POST"])
def handle_unverified():
"""Handle case where user tries to login but is unverified"""
- form = request.form
+ form = request.json
# TODO: Maybe have a GN2_URI setting here?
# or pass the client_id here?
return render_template(
@@ -321,7 +321,7 @@ def handle_unverified():
@users.route("/send-verification", methods=["POST"])
def send_verification_code():
"""Send verification code email."""
- form = request.form
+ form = request.json
with (db.connection(current_app.config["AUTH_DB"]) as conn,
db.cursor(conn) as cursor):
user = user_by_email(conn, form["user_email"])