Skip to content

fix(auth )login success screen#6

Open
luanvdw wants to merge 1 commit into
mainfrom
fix/auth-login
Open

fix(auth )login success screen#6
luanvdw wants to merge 1 commit into
mainfrom
fix/auth-login

Conversation

@luanvdw
Copy link
Copy Markdown
Member

@luanvdw luanvdw commented May 11, 2026

Updates the OAuth login success screen with UTF-8 rendering, themed styling, workspace-aware copy, and better callback coverage.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

Review Change Stack

Walkthrough

This PR enhances the Prisma CLI OAuth login flow to display a customized success page. After successful authentication, the callback handler resolves the workspace name from stored tokens via the management API, renders a personalized HTML success page with proper HTML escaping, and returns it with UTF-8 charset metadata. Tests validate charset handling, workspace name resolution, HTML escaping, fallback behavior, and styling. Documentation updates describe the confirmation behavior.

Changes

OAuth Login Success Page with Workspace Resolution

Layer / File(s) Summary
State Storage Field
packages/cli/src/lib/auth/login.ts
LoginState now stores tokenStorage as an instance field, initialized before SDK creation to enable workspace name resolution.
Workspace Name Resolution
packages/cli/src/lib/auth/login.ts
LoginState.resolveWorkspaceName() reads tokens from tokenStorage, fetches the workspace record via management API, and returns the workspace name or null on missing tokens or errors.
Success Page Generation
packages/cli/src/lib/auth/login.ts
renderSuccessPage(workspaceName) generates workspace-specific or fallback generic success HTML, and escapeHtml(value) prevents HTML injection by escaping the workspace name before embedding.
Callback Handler Orchestration
packages/cli/src/lib/auth/login.ts
The /auth/callback handler resolves workspace name, sets Content-Type header with charset=utf-8, and responds with the dynamically rendered success page.
Tests and Validation
packages/cli/tests/auth-login.test.ts
Test suite verifies charset and meta tag handling, workspace-specific success copy, HTML escaping, fallback copy, theme CSS inclusion, and logo styling. Helper function requestSuccessPage mocks TokenStorage and management API to simulate the complete callback flow.
Command Specification
docs/product/command-spec.md
Updated prisma-cli auth login specification to document that successful browser authentication confirms success and returns control to the terminal.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing/updating the auth login success screen, which is the primary focus across all modified files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description accurately describes the changeset, covering UTF-8 rendering, themed styling, workspace-aware copy, and callback coverage improvements.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/auth-login
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/auth-login

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@luanvdw luanvdw requested a review from AmanVarshney01 May 11, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant