diff options
author | Frederick Muriuki Muriithi | 2024-06-17 14:29:50 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-06-17 14:29:50 -0500 |
commit | b472424eca8ae14e154c41cee2a4ecd9d0810334 (patch) | |
tree | 5986f1ef148a86237a563d5e15c73926ed47e740 | |
parent | fc1c34201fe6d905d7bea9ec19cd7ae59af48e0c (diff) | |
download | gn-auth-b472424eca8ae14e154c41cee2a4ecd9d0810334.tar.gz |
Bug: use or's short-circuiting to prevent evaluation of statements
Without the `or` later statements were being evaluated, before the
final value was computed. This commit short-circuits that behaviour.
-rw-r--r-- | gn_auth/auth/authentication/oauth2/views.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gn_auth/auth/authentication/oauth2/views.py b/gn_auth/auth/authentication/oauth2/views.py index fc27768..22437a2 100644 --- a/gn_auth/auth/authentication/oauth2/views.py +++ b/gn_auth/auth/authentication/oauth2/views.py @@ -37,9 +37,9 @@ def authorise(): """Authorise a user""" try: server = app.config["OAUTH2_SERVER"] - client_id = uuid.UUID(request.args.get( - "client_id", - request.form.get("client_id", str(uuid.uuid4())))) + client_id = uuid.UUID(request.args.get("client_id") + or request.form.get("client_id") + or str(uuid.uuid4())) client = server.query_client(client_id) if not bool(client): flash("Invalid OAuth2 client.", "alert-danger") |