From c17afe8c11789cced8e5edde7bd61a5dfbbac9a7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 22 Mar 2026 12:47:15 +0000 Subject: [PATCH] fix(auth): address code review feedback - accessibility, docstrings, portable test paths Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/51d9bb59-d4b5-4713-9a4a-8acfc599e2cc --- app/auth.py | 11 ++++++- frontend/templates/admin_connections.html | 37 ++++++++++++++++++++--- tests/test_connections.py | 2 +- 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/app/auth.py b/app/auth.py index f1fd5eb7..112ad22c 100644 --- a/app/auth.py +++ b/app/auth.py @@ -109,6 +109,15 @@ def _dropbox_userinfo_compliance_fix(client, user_cls, token, data): Dropbox's /2/users/get_current_account returns a non-standard response format. This compliance fix normalizes the response data — the HTTP method (POST) is handled by authlib's compliance infrastructure. + + Args: + client: The OAuth client instance (required by authlib compliance fix interface). + user_cls: The user class (required by authlib compliance fix interface). + token: The OAuth token dict. + data: The raw userinfo response dict from Dropbox. + + Returns: + The normalized userinfo dict with ``sub`` and ``name`` fields. """ # Dropbox returns account_id instead of sub if "account_id" in data and "sub" not in data: @@ -435,7 +444,7 @@ async def login(request: Request): show_oauth = OAUTH_CONFIGURED # SSO Auto Login: redirect directly to SSO provider if configured - if show_oauth and getattr(settings, "sso_auto_login", False) is True and not error and not message: + if show_oauth and settings.sso_auto_login is True and not error and not message: return RedirectResponse(url="/oauth-login", status_code=status.HTTP_302_FOUND) return templates.TemplateResponse( diff --git a/frontend/templates/admin_connections.html b/frontend/templates/admin_connections.html index aca4f105..c3e7af78 100644 --- a/frontend/templates/admin_connections.html +++ b/frontend/templates/admin_connections.html @@ -104,10 +104,13 @@ -