From b472424eca8ae14e154c41cee2a4ecd9d0810334 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 17 Jun 2024 14:29:50 -0500 Subject: 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. --- gn_auth/auth/authentication/oauth2/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gn_auth/auth/authentication') 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") -- cgit v1.2.3