-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: handle expired/invalid cognito code #1275
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe updates introduce new functionalities and error handling for verification codes in both the front-end and back-end. Key changes include adding new messages in the localization file, enabling build in source for Lambda configurations, enhancing the user API with a resend code procedure, and updating the Cognito client to handle local development environments. Additionally, new error handling for code expiration and mismatch has been integrated, along with UI improvements for account verification. Changes
Tip New Features and ImprovementsReview SettingsIntroduced new personality profiles for code reviews. Users can now select between "Chill" and "Assertive" review tones to tailor feedback styles according to their preferences. The "Assertive" profile posts more comments and nitpicks the code more aggressively, while the "Chill" profile is more relaxed and posts fewer comments. AST-based InstructionsCodeRabbit offers customizing reviews based on the Abstract Syntax Tree (AST) pattern matching. Read more about AST-based instructions in the documentation. Community-driven AST-based RulesWe are kicking off a community-driven initiative to create and share AST-based rules. Users can now contribute their AST-based rules to detect security vulnerabilities, code smells, and anti-patterns. Please see the ast-grep-essentials repository for more information. New Static Analysis ToolsWe are continually expanding our support for static analysis tools. We have added support for Tone SettingsUsers can now customize CodeRabbit to review code in the style of their favorite characters or personalities. Here are some of our favorite examples:
Revamped Settings PageWe have redesigned the settings page for a more intuitive layout, enabling users to find and adjust settings quickly. This change was long overdue; it not only improves the user experience but also allows our development team to add more settings in the future with ease. Going forward, the changes to Miscellaneous
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Quality Gate passedIssues Measures |
#453 Bundle Size — 3.4MiB (+0.04%).Warning Bundle contains 5 duplicate packages – View duplicate packages Bundle metrics
|
Current #453 |
Baseline #440 |
|
---|---|---|
Initial JS | 3MiB (+0.04% ) |
3MiB |
Initial CSS | 9.54KiB |
9.54KiB |
Cache Invalidation | 42.4% |
52.73% |
Chunks | 67 |
67 |
Assets | 80 |
80 |
Modules | 2000 |
2000 |
Duplicate Modules | 270 |
270 |
Duplicate Code | 7.85% |
7.85% |
Packages | 210 |
210 |
Duplicate Packages | 5 |
5 |
Bundle size by type 1 change
1 regression
Current #453 |
Baseline #440 |
|
---|---|---|
JS | 3.28MiB (+0.04% ) |
3.28MiB |
Fonts | 94.54KiB |
94.54KiB |
Other | 9.62KiB |
9.62KiB |
CSS | 9.54KiB |
9.54KiB |
IMG | 8.57KiB |
8.57KiB |
Bundle analysis report Branch JoeKarow/signup-error-handling Project dashboard
📦 Next.js Bundle Analysis for @weareinreach/appThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Outside diff range and nitpick comments (2)
packages/auth/lib/cognitoClient.ts (1)
Line range hint
15-37
: Consider using thenode:
protocol when importing Node.js built-in modules to follow best practices and ensure compatibility with newer Node.js versions.- import { createHmac } from 'crypto' + import { createHmac } from 'node:crypto'packages/ui/modals/AccountVerified.tsx (1)
Line range hint
47-219
: The implementation of the account verification modal with handling for different states and code resend functionality is well done. However, ensure that all dependencies are correctly listed in hooks to avoid potential bugs.- useEffect(() => { - if (router.query.c !== undefined) { - handler.open() - } - }, [router.query.c]) + useEffect(() => { + if (router.query.c !== undefined) { + handler.open() + } + }, [router.query.c, handler.open])
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (12)
- apps/app/public/locales/en/common.json (2 hunks)
- lambdas/cognito-messaging/samconfig.toml (1 hunks)
- lambdas/cognito-user-migrate/samconfig.toml (1 hunks)
- packages/api/router/user/index.ts (1 hunks)
- packages/api/router/user/mutation.confirmAccount.handler.ts (1 hunks)
- packages/api/router/user/mutation.resendCode.handler.ts (1 hunks)
- packages/api/router/user/mutation.resendCode.schema.ts (1 hunks)
- packages/api/router/user/schemas.ts (1 hunks)
- packages/auth/lib/cognitoClient.ts (2 hunks)
- packages/auth/lib/confirmAccount.ts (1 hunks)
- packages/env/index.ts (1 hunks)
- packages/ui/modals/AccountVerified.tsx (4 hunks)
Files skipped from review due to trivial changes (5)
- lambdas/cognito-messaging/samconfig.toml
- lambdas/cognito-user-migrate/samconfig.toml
- packages/api/router/user/schemas.ts
- packages/auth/lib/confirmAccount.ts
- packages/env/index.ts
Additional Context Used
Biome (8)
packages/api/router/user/mutation.confirmAccount.handler.ts (2)
8-9: All these imports are only used as types.
10-11: All these imports are only used as types.
packages/api/router/user/mutation.resendCode.handler.ts (2)
2-3: All these imports are only used as types.
4-5: All these imports are only used as types.
packages/auth/lib/cognitoClient.ts (2)
12-12: A Node.js builtin module should be imported with the node: protocol.
7-8: All these imports are only used as types.
packages/ui/modals/AccountVerified.tsx (2)
43-43: The computed expression can be simplified without the use of a string literal.
72-72: This hook does not specify all of its dependencies: handler.open
Additional comments not posted (8)
packages/api/router/user/mutation.resendCode.schema.ts (1)
5-14
: TheZResendCodeSchema
andTResendCodeSchema
are well-defined to handle different input forms. Consider removing the commented-out code if it's no longer relevant.packages/api/router/user/mutation.resendCode.handler.ts (1)
7-15
: TheresendCode
function is well-implemented with proper error handling. Good job!packages/api/router/user/mutation.confirmAccount.handler.ts (1)
14-47
: TheconfirmAccount
function is robust, handling different specific exceptions and updating user verification status in the database. Well done!packages/api/router/user/index.ts (1)
94-100
: The integration of theresendCode
procedure into the user router is correctly implemented. Good job!packages/auth/lib/cognitoClient.ts (1)
36-37
: The conditional assignment of theendpoint
property based onisLocalDev
is correctly implemented. Well done!apps/app/public/locales/en/common.json (3)
56-57
: Localization strings for verification code requests and resends are correctly added.
119-120
: Localization strings for expired and mismatched codes are correctly added.
122-122
: Localization string for requesting a new code is correctly added.
Pull Request type
Please check the type of change your PR introduces:
What is the current behavior?
Issue Number: N/A
Coderabbit Summary
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Configuration
build_in_source
parameter to Lambda function configurations.Does this introduce a breaking change?
Other information