-
Notifications
You must be signed in to change notification settings - Fork 0
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: update button to a link #1153
Conversation
WalkthroughThe changes in this pull request primarily involve updates to the Changes
Possibly related PRs
🪧 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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (9)
src/components/InvalidSession.tsx
(1 hunks)src/localesLogin2/cs/default.json
(2 hunks)src/localesLogin2/en/default.json
(2 hunks)src/localesLogin2/fi/default.json
(2 hunks)src/localesLogin2/it/default.json
(2 hunks)src/localesLogin2/nb/default.json
(2 hunks)src/localesLogin2/pl/default.json
(2 hunks)src/localesLogin2/sv/default.json
(2 hunks)src/routes/universal-login/routes.tsx
(1 hunks)
🔇 Additional comments (10)
src/components/InvalidSession.tsx (1)
25-30
: LGTM! Good semantic improvement.
The change from a button to an anchor element is semantically correct for navigation purposes, while maintaining proper styling and user interaction feedback.
src/localesLogin2/en/default.json (1)
12-12
: LGTM! Improved text formatting.
The new translation key follows conventions, and the line breaks in invalid_session_body
improve readability.
Also applies to: 57-57
src/localesLogin2/cs/default.json (1)
12-12
: LGTM! Consistent localization.
The Czech translations maintain consistent meaning and formatting with the English version.
Also applies to: 57-57
src/localesLogin2/nb/default.json (1)
12-12
: LGTM! Translations are accurate and consistent.
The Norwegian translations are grammatically correct and maintain consistency with other language versions:
- "fortsett med bruker" correctly translates to "continue with user"
- The invalid session message maintains the same meaning and structure as other languages
Also applies to: 57-57
src/localesLogin2/sv/default.json (1)
12-12
: LGTM! Swedish translations maintain language-specific accuracy.
The Swedish translations appropriately use language-specific constructions:
- "fortsätt med användaren" correctly uses the definite article form
- Line breaks in the invalid session message improve readability while maintaining meaning
Also applies to: 57-57
src/localesLogin2/pl/default.json (1)
57-57
: LGTM! Invalid session message is properly formatted.
The line breaks improve readability while maintaining accurate translation.
src/localesLogin2/fi/default.json (1)
12-12
: LGTM! Localization changes look good.
The changes maintain proper Finnish localization while improving readability:
- Added new key for email check title
- Enhanced readability of invalid session message with proper line breaks
Also applies to: 57-57
src/localesLogin2/it/default.json (1)
12-12
: LGTM! Localization changes look good.
The changes maintain proper Italian localization while improving readability:
- Added new key for email check title
- Enhanced readability of invalid session message with proper line breaks
Also applies to: 57-57
src/routes/universal-login/routes.tsx (2)
1572-1575
: LGTM! Proper URL construction and error handling.
The code correctly:
- Uses the URL API for safe URL construction
- Includes proper null checks for redirect_uri and state
- Sets appropriate error parameters
1584-1584
: LGTM! Component prop update.
The InvalidSessionPage component now receives the redirectUrl prop, aligning with the PR objective of updating the button to a link.
@@ -9,6 +9,7 @@ | |||
"and": "i", | |||
"callback_url_mismatch": "Niezgodność adresu URL wywołania zwrotnego", | |||
"callback_url_not_allowed": "Podany adres redirect_uri nie znajduje się na liście dozwolonych adresów URL wywołania zwrotnego.", | |||
"check_email_title": "kontynuować z użytkownikiem", |
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.
🛠️ Refactor suggestion
Use imperative form for consistency with UI language.
The current translation uses the infinitive form "kontynuować" (to continue), but the imperative form would be more consistent with other UI elements in Polish.
Apply this change:
- "check_email_title": "kontynuować z użytkownikiem",
+ "check_email_title": "kontynuuj z użytkownikiem",
📝 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.
"check_email_title": "kontynuować z użytkownikiem", | |
"check_email_title": "kontynuuj z użytkownikiem", |
let redirectUrl: URL | undefined; | ||
|
||
if (session.authParams.redirect_uri && session.authParams.state) { | ||
redirectUrl = new URL(session.authParams.redirect_uri); | ||
redirectUrl.searchParams.set("state", session.authParams.state); | ||
redirectUrl.searchParams.set("error", "invalid_session"); | ||
redirectUrl.searchParams.set( | ||
"error_description", | ||
session.authParams.username || "", | ||
); | ||
} |
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.
Consider PII exposure in error_description.
The code exposes the username in the error_description parameter of the redirect URL. This might leak PII (Personally Identifiable Information) to the client application's logs or analytics.
Consider using a generic error message instead:
- redirectUrl.searchParams.set(
- "error_description",
- session.authParams.username || "",
- );
+ redirectUrl.searchParams.set(
+ "error_description",
+ "Session is no longer valid",
+ );
📝 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.
let redirectUrl: URL | undefined; | |
if (session.authParams.redirect_uri && session.authParams.state) { | |
redirectUrl = new URL(session.authParams.redirect_uri); | |
redirectUrl.searchParams.set("state", session.authParams.state); | |
redirectUrl.searchParams.set("error", "invalid_session"); | |
redirectUrl.searchParams.set( | |
"error_description", | |
session.authParams.username || "", | |
); | |
} | |
let redirectUrl: URL | undefined; | |
if (session.authParams.redirect_uri && session.authParams.state) { | |
redirectUrl = new URL(session.authParams.redirect_uri); | |
redirectUrl.searchParams.set("state", session.authParams.state); | |
redirectUrl.searchParams.set("error", "invalid_session"); | |
redirectUrl.searchParams.set( | |
"error_description", | |
"Session is no longer valid", | |
); | |
} |
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.
I wanted to send it there so we could initiate a new login from the client. Not sure if there's a better way to start a new login flow?
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.
@markusahlstrand, including the username in the error_description
parameter can expose PII, as it might be logged or stored in browser history. To initiate a new login flow from the client without exposing sensitive information, you could use a specific error code like error=invalid_session
. The client can then detect this error code and prompt the user to start a new login process. This approach avoids sending any PII in the redirect URL while still allowing the client to handle the situation appropriately.
Let me know if this solution works for you or if you need further assistance.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation