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
This commit is contained in:
copilot-swe-agent[bot]
2026-03-22 12:47:15 +00:00
parent 0287a165cf
commit c17afe8c11
3 changed files with 44 additions and 6 deletions
+10 -1
View File
@@ -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(