Skip to content
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-issue-7011 #7125

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

fix-issue-7011 #7125

wants to merge 2 commits into from

Conversation

vsnegi039
Copy link

@vsnegi039 vsnegi039 commented Feb 16, 2025

Summary

Redirect users to login if invitation token is invalid or missing

Related Issues / PR's

#7011

Screenshots

image

image

Affected Areas and Manually Tested Areas


Important

Redirects users to login in SignUp.tsx if invitation token is invalid or missing, with error notifications.

  • Behavior:
    • Redirects to login if token is invalid or missing in SignUp.tsx.
    • Displays error notification with message t('token_required') if token is empty.
    • Redirects to login if getInviteDetailsResponse.data?.error is present.
  • Functions:
    • Adds notifications.error call in SignUp() to handle missing token.
    • Uses history.push(ROUTES.LOGIN) for redirection in SignUp().

This description was created by Ellipsis for 97e2de6. It will automatically update as commits are pushed.

@vsnegi039 vsnegi039 requested a review from YounixM as a code owner February 16, 2025 18:20
Copy link

welcome bot commented Feb 16, 2025

Welcome to the SigNoz community! Thank you for your first pull request and making this project better. 🤗

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


vsnegi039 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested. Reviewed everything up to 97e2de6 in 1 minute and 29 seconds

More details
  • Looked at 42 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. frontend/src/pages/SignUp/SignUp.tsx:113
  • Draft comment:
    Consider handling redirection and notification inside useEffect dependencies to ensure predictable side-effects. Also, review inline style usages in notifications if possible, using design tokens/constants.
  • Reason this comment was not posted:
    Marked as duplicate.
2. frontend/src/pages/SignUp/SignUp.tsx:63
  • Draft comment:
    Avoid performing side-effects (like history.push) directly in the render body. Consider moving this token check and redirection into a useEffect hook to prevent unexpected behavior.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_2nnvhYgXr9dJulss


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@@ -59,6 +60,13 @@ function SignUp({ version }: SignUpProps): JSX.Element {
const { search } = useLocation();
const params = new URLSearchParams(search);
const token = params.get('token');
if (token === '') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid side-effects during render: redirecting (history.push) and triggering notifications should be done in useEffect rather than in the component body.

@@ -59,6 +60,13 @@ function SignUp({ version }: SignUpProps): JSX.Element {
const { search } = useLocation();
const params = new URLSearchParams(search);
const token = params.get('token');
if (token === '') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition 'if (token === "")' only catches empty strings. Consider using 'if (!token)' to also handle the null case, ensuring missing tokens are correctly redirected.

Suggested change
if (token === '') {
if (!token) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants