Extend users password reset token TTL to 30 days#1162
Conversation
Collaboration invite links reuse the password reset token. 30 min TTL meant invitees who didn't click immediately got an expired-token error with no clear recovery path. 30 days matches typical invite UX. Snapshot-only — existing installs need to update via PocketBase admin.
📝 WalkthroughWalkthroughSingle migration file update that increases password reset token duration from 1800 to 2592000 seconds in the ChangesPassword Reset Token Duration Update
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 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 docstrings
🧪 Generate unit tests (beta)
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: 1
🤖 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 `@migrations/1757326533_collections_snapshot.go`:
- Around line 775-776: The migration increases users.passwordResetToken.duration
to 2,592,000s (~30 days) which lengthens the takeover window; revert this to a
short lifetime (e.g. 3600–86400s) for the existing reset token and implement a
separate invite token/flow instead of reusing the passwordResetToken: change the
migrated value for users.passwordResetToken.duration back to a short TTL, and
add a new token/collection/type for invites (used by
user.NewPasswordResetToken()/invite generation and confirmPasswordReset should
only accept the short-lived password reset token for real resets), or introduce
separate handlers so Users.requestPasswordReset/confirmPasswordReset continue to
use the short-lived token while invites use a distinct token/record and
confirmation path.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6031fcdd-c7ce-472c-a8bd-92da7eec77fe
📒 Files selected for processing (1)
migrations/1757326533_collections_snapshot.go
addresses issue where collaborator invitations don't work
Summary
users.passwordResetToken.durationin the collections snapshot from 1800s (30 min) to 2592000s (30 days)./admin/auth?create=<token>&email=…) reuse PocketBase's password reset token. With a 30-minute TTL, invitees who didn't click immediately hit an expired-token error with no clear recovery path — surfaced as "I can't create my account."Scope
1800and need to update via PocketBase admin (Collections → users → Options → Password reset duration)._superuserstoken TTL is intentionally left at 1800 — admin password resets should stay short-lived.Test plan
2592000on the users collectionSummary by CodeRabbit