Enhance user authentication, feedback metadata, and subscription handling#3535
Conversation
- Updated feedback metadata to include full URL with search parameters. - Changed feedback platform type from 'web' to 'Analytics'. feat: extend next-auth types for user authentication methods - Added `authMethods` and `expiresAt` fields to User and Session interfaces in next-auth types. - Updated JWT interface to include new fields. feat: modify header component to conditionally show auth controls - Introduced `showAuthControlsOnlyWhenAuthenticated` prop to Header component. - Updated rendering logic to show auth controls based on user authentication status. feat: add set password functionality for OAuth users - Implemented `useSetPassword` hook for setting passwords for OAuth-authenticated users. - Created `SetPasswordPromptDialog` component to prompt users to set a password. feat: add password validation schema - Added `setPasswordSchema` for validating password input during set password flow. fix: normalize subscription status to handle 'canceled' and 'paused' - Updated `normalizeStatus` function to recognize 'canceled' as a valid status. - Added 'paused' status to subscription handling. feat: enhance user service with set password endpoint - Implemented `setPassword` method in UserService for updating passwords. - Added error handling for password setting process. chore: update API types for new password functionality - Added `SetPasswordRequest` and `SetPasswordResponse` interfaces to API types. - Updated User interface to include `authMethods`. refactor: improve OAuth session handling with auth methods - Enhanced OAuth session and profile handling to include `authMethods`. - Updated session management to reflect changes in user authentication methods.
|
Warning Review limit reached
Your plan includes 1 review of capacity. Refill in 38 minutes and 58 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR introduces a comprehensive authentication methods tracking system for OAuth users, adds password-setting capability via a prompt dialog, refactors subscription management with dialog-driven confirmations, and improves various UI components with updated copy, routing logic, and table layout. ChangesAuthentication Methods System & Password Management
Header Conditional Auth Controls & Routing
Billing & Subscription UI Refactor
Feedback Table & Analytics Updates
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
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. Comment |
|
New azure analytics_platform changes available for preview here |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
src/platform/src/shared/lib/auth.ts (1)
100-135: ⚡ Quick winExtract
normalizeAuthMethodsinto a shared helper used by both auth flows.This normalization logic is duplicated in
src/platform/src/shared/lib/oauth-session.ts. A single shared utility avoids provider-key drift and keeps token/session behavior consistent.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/platform/src/shared/lib/auth.ts` around lines 100 - 135, Move the duplicated normalizeAuthMethods logic (and AUTH_METHOD_KEYS) into a single exported helper module and have both usages import it: create a shared function (exported) that returns AuthMethods | undefined and reuse it from the existing callers (e.g., where normalizeAuthMethods is currently declared and in oauth-session.ts), ensure the helper exports or reuses the AuthMethods type, keep the exact boolean mapping for keys ('password','google','github','linkedin','microsoft','twitter','facebook','apple'), and replace the local implementations with an import of the shared normalizeAuthMethods to avoid drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/platform/src/modules/feedback/components/FeedbackLauncher.tsx`:
- Around line 78-79: The metadata's `page` value (built from
window.location.pathname + window.location.search) can go stale because it's
computed inside a useMemo that only depends on `pathname`; update the code in
FeedbackLauncher so `page` is recomputed at submit time instead of relying on
the memo: leave the existing metadata useMemo for stable fields (e.g., browser
via getBrowserLabel()) but remove or stop reading the cached `page` there, and
in the submit handler (the function that sends/creates feedback) construct the
`page` value afresh from window.location.pathname + window.location.search and
attach it to the metadata payload you send; alternatively, if you prefer a memo,
include window.location.search (or a derived `search` variable) in the useMemo
dependency array so `page` updates on query-only changes.
- Around line 78-79: The metadata.page value in FeedbackLauncher.tsx currently
forwards the full query string and must be sanitized before persisting; update
the code that sets metadata.page to parse window.location.search, remove or
redact sensitive keys (e.g., code, state, token, access_token, refresh_token,
id_token, session, auth, nonce, secret) and then rebuild the pathname+safe query
(or omit the query if empty) so only non-sensitive params are included; locate
the metadata construction in the FeedbackLauncher component (the metadata.page
assignment) and replace it with a sanitized URL generation step that uses
URLSearchParams to filter out the listed keys and produce the final page value.
In `@src/platform/src/shared/components/auth/SetPasswordPromptDialog.tsx`:
- Around line 133-147: The flow in markPasswordAsConfigured conflates failures
from update() (session/authMethods persistence) with the password-save result,
causing misleading toasts and repeated prompts; change markPasswordAsConfigured
to call update() in a try/catch so that if update() fails you log/emit a
session-update specific error (or show a distinct toast) but still treat the
password as successfully configured (proceed to remove dismissStorageKey and
setIsOpen(false)); reference the markPasswordAsConfigured function, the update()
call, sessionStorage.removeItem(dismissStorageKey) and setIsOpen(false) when
implementing the change so failures in update() do not cause the UI to indicate
password save failed.
---
Nitpick comments:
In `@src/platform/src/shared/lib/auth.ts`:
- Around line 100-135: Move the duplicated normalizeAuthMethods logic (and
AUTH_METHOD_KEYS) into a single exported helper module and have both usages
import it: create a shared function (exported) that returns AuthMethods |
undefined and reuse it from the existing callers (e.g., where
normalizeAuthMethods is currently declared and in oauth-session.ts), ensure the
helper exports or reuses the AuthMethods type, keep the exact boolean mapping
for keys
('password','google','github','linkedin','microsoft','twitter','facebook','apple'),
and replace the local implementations with an import of the shared
normalizeAuthMethods to avoid drift.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 49667b66-791e-44f6-a4a3-853311aecb72
📒 Files selected for processing (23)
src/platform/middleware.tssrc/platform/src/app/(dashboard)/request-organization/layout.tsxsrc/platform/src/app/(dashboard)/system/feedback/page.tsxsrc/platform/src/modules/billing/BillingPage.tsxsrc/platform/src/modules/billing/components/CheckoutDialog.tsxsrc/platform/src/modules/billing/components/SubscriptionSection.tsxsrc/platform/src/modules/feedback/components/FeedbackLauncher.tsxsrc/platform/src/next-auth.d.tssrc/platform/src/shared/components/auth/SetPasswordPromptDialog.tsxsrc/platform/src/shared/components/auth/SocialAuthSection.tsxsrc/platform/src/shared/components/header/index.tsxsrc/platform/src/shared/components/header/types/index.tssrc/platform/src/shared/hooks/index.tssrc/platform/src/shared/hooks/useUser.tssrc/platform/src/shared/layouts/MainLayout.tsxsrc/platform/src/shared/lib/auth.tssrc/platform/src/shared/lib/oauth-session.tssrc/platform/src/shared/lib/validators.tssrc/platform/src/shared/providers/auth-provider.tsxsrc/platform/src/shared/services/subscriptionService.tssrc/platform/src/shared/services/userService.tssrc/platform/src/shared/types/api.tssrc/platform/src/shared/types/global.d.ts
💤 Files with no reviewable changes (1)
- src/platform/src/shared/components/auth/SocialAuthSection.tsx
|
New azure analytics_platform changes available for preview here |
Status of maturity (all need to be checked before merging):
Screenshots (optional)
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes & Improvements