fix: clean up password reset logic per ticket id 671#1158
Conversation
|
Warning Review limit reached
More reviews will be available in 19 minutes and 57 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThis PR consolidates the password reset UI by refactoring ChangesPassword reset modal consolidation
🚥 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. 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@frontend/src/components/shared/ResetPasswordModal.tsx`:
- Around line 82-100: The frontend uses handleReset which calls
API.post(`users/${userId}/student-password`) but the backend handler is
handleResetStudentPassword and its authorization (canResetUserPassword) already
allows admin resets, so the route name is misleading; rename the endpoint and
handler to a neutral name (e.g., users/{id}/reset-password or
handleResetUserPassword) and update all references including API.post in
handleReset and any docs/UI copy (or alternatively add clear docs/comments
linking the existing student-password route to admin usage) so the route name
accurately reflects its purpose and prevents confusion.
In `@frontend/src/pages/admin/StudentManagement.tsx`:
- Around line 650-654: The BulkImportDialog success handler only calls mutate()
so the stats cards don't refresh; change its onSuccess to call the existing
handleMutate function (which refreshes both the list and the resident totals)
instead of mutate — update the BulkImportDialog prop from onSuccess={() => void
mutate()} to onSuccess={() => void handleMutate()} (or call handleMutate() in
addition to mutate if you want to keep the original behavior).
🪄 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: ASSERTIVE
Plan: Pro Plus
Run ID: 41bd81f5-6b2e-47e1-bab4-c2a4b59e6e7a
📒 Files selected for processing (7)
frontend/src/components/residents/BulkActionDialogs.tsxfrontend/src/components/residents/ResidentDialogs.tsxfrontend/src/components/shared/ResetPasswordModal.tsxfrontend/src/components/shared/index.tsfrontend/src/pages/admin/AdminManagement.tsxfrontend/src/pages/admin/ResidentProfile.tsxfrontend/src/pages/admin/StudentManagement.tsx
| <BulkImportDialog | ||
| open={bulkImportOpen} | ||
| onOpenChange={setBulkImportOpen} | ||
| onSuccess={() => void mutate()} | ||
| /> |
There was a problem hiding this comment.
Refresh the stats cards after bulk import.
BulkImportDialog only revalidates the table query here. The resident totals above stay stale until SWR happens to refetch, even though handleMutate already encapsulates the correct list + stats refresh pair.
Suggested fix
<BulkImportDialog
open={bulkImportOpen}
onOpenChange={setBulkImportOpen}
- onSuccess={() => void mutate()}
+ onSuccess={handleMutate}
/>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <BulkImportDialog | |
| open={bulkImportOpen} | |
| onOpenChange={setBulkImportOpen} | |
| onSuccess={() => void mutate()} | |
| /> | |
| <BulkImportDialog | |
| open={bulkImportOpen} | |
| onOpenChange={setBulkImportOpen} | |
| onSuccess={handleMutate} | |
| /> |
🤖 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 `@frontend/src/pages/admin/StudentManagement.tsx` around lines 650 - 654, The
BulkImportDialog success handler only calls mutate() so the stats cards don't
refresh; change its onSuccess to call the existing handleMutate function (which
refreshes both the list and the resident totals) instead of mutate — update the
BulkImportDialog prop from onSuccess={() => void mutate()} to onSuccess={() =>
void handleMutate()} (or call handleMutate() in addition to mutate if you want
to keep the original behavior).
86fbe21 to
dcc75b6
Compare
corypride
left a comment
There was a problem hiding this comment.
frontend/src/pages/admin/resident-profile/ResetPasswordDialog.tsx is no longer imported anywhere after this PR — ResidentProfile.tsx switches to ResetPasswordModal but the old file isn't deleted. Safe to remove.
Otherwise the consolidation looks good — the new modal handles both modes cleanly and the clipboard fallback is an improvement over the old implementations.
Pre-Submission PR Checklist
Description of the change
Cleaned up password reset logic per ticket 671.