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: cookies functionality, hyperlinks and shown appropriate content in footer #1079

Merged
merged 18 commits into from
Oct 16, 2023

Conversation

YuvarajSingh-0
Copy link
Member

closes #1070

👷🏻 Changes made

Corrected cookie names all around code and fixed backend code that fixes this issue.

📸 Screenshots

Before Logging in 👇
image

After logging in 👇
Screenshot 2023-09-25 161216

@github-actions github-actions bot added 🐞 bug This is a patch, generally fixing some bugs. status: todo ⏳ This issue is yet to be seen by the maintainer of the project. labels Sep 25, 2023
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hello @YuvarajSingh-0, thank you for raising a pull request.

Currently, the pull request is marked as https://github.com/MilanCommunity/Milan/labels/%F0%9F%91%B7%F0%9F%8F%BB%E2%80%8D%E2%99%82%EF%B8%8F%20status%3A%20awaiting%20triage which means that work for this issue is on hold and we are waiting for the maintainers/owner to review it and provide you with feedback/suggestions to proceed further.

Feel free to reach out to Tamal on Twitter, or drop a mail at tamalcodes@gmail.com if you think that this pull request is of critical priority.

Give us a ⭐ to show some support
Happy OpenSource 🚀

@github-actions github-actions bot temporarily deployed to Preview September 25, 2023 10:47 Inactive
@github-actions github-actions bot added the deployed This PR has been deployed to Vercel for testing. label Sep 25, 2023
@YuvarajSingh-0
Copy link
Member Author

@tamalCodes Is this good?

Copy link
Member

@tamalCodes tamalCodes left a comment

Choose a reason for hiding this comment

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

Hi @YuvarajSingh-0 , i don't think you need to change any backend code OR the cookie name. The isLoggedIn cookie is being set and cleared by the backend itself - there's a logout issue because of the domain property maybe which I am working on actively.

However, with context to this issue, the isLoggedIn property is accessible in the code, look at the Navbar for example. Please use that cookie itself without further modifying any server-side code OR cookie name for the same.

Waiting for the changes in the PR !

@tamalCodes tamalCodes changed the title fix: corrected cookies functionality, hyperlinks and shown appropriate content in footer (#1070) fix: cookies functionality, hyperlinks and shown appropriate content in footer Sep 25, 2023
@tamalCodes tamalCodes added area/logic This issue is related to a logic fix. status: need changes 🚧 Changes have been requested for these PRs and removed status: todo ⏳ This issue is yet to be seen by the maintainer of the project. labels Sep 25, 2023
@YuvarajSingh-0
Copy link
Member Author

@tamalCodes You mentioned the backend clears the isLoggedIn cookie but it doesn't which also raises issues with sign in and signup button visibility after logging out, but as you mentioned you are working on it, I am not going to modify anything in backend.

Let me modify the code to create new PR

src/components/Footer/Footer.jsx Outdated Show resolved Hide resolved
src/components/Footer/Footer.jsx Outdated Show resolved Hide resolved
src/pages/Donate/Donate.jsx Outdated Show resolved Hide resolved
Copy link
Member

@tamalCodes tamalCodes left a comment

Choose a reason for hiding this comment

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

Please make these minor changes.

Copy link
Member

Choose a reason for hiding this comment

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

It looks like you have resolved the conflicts in the wrong manner. You overwrote the incoming changes (the changes that I made) with the changes of the current branch (the changes that you had previously).

That is a reason why some UI has also changed. Take a look at this screenshot below.
The left image is the changes that are made by you. The right one is what is currently deployed.

image

Please fix this.

Copy link
Member Author

Choose a reason for hiding this comment

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

So, you want the left image to look like the right one.... Right?

Copy link
Member

Choose a reason for hiding this comment

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

Correct. You can check the current code that we have for more reference.

Copy link
Member Author

@YuvarajSingh-0 YuvarajSingh-0 Oct 7, 2023

Choose a reason for hiding this comment

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

What should I replace in place of 'usertype' cookie? (in line number 28 in HomeBanner.jsx)

Copy link
Member

@tamalCodes tamalCodes Oct 7, 2023

Choose a reason for hiding this comment

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

I think starting from here it would be the best to keep the changes as it is.

I previously updated the code for the home banner about what to show in the buttons on instances where the user is not logged in, the club is logged in OR the user is logged in. So I think we can maybe ignore the changes for the HomeBanner.jsx file.

I also see that you have optimized the code for the conditional rendering, thanks for that.
Can you confirm for me if the Login and Logout-based rendering functionality is working perfectly for the footer and stuffs ? IF yes we can merge the same.

Copy link
Member Author

@YuvarajSingh-0 YuvarajSingh-0 Oct 7, 2023

Choose a reason for hiding this comment

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

Yes, It's Working fine, I've checked it now.

There was also an issue with login trigger while logging in i.e., the login functionality is not hitting the correct backend url for login, I fixed it in ApiEndpoints.js file. And also upon clicking the profile icon after logging in, due to this line the redirecting url does not exist due to no usertype cookie. But I think that part of code depends on backend, like setting cookie with name usertype and all.

Apart from these, the footer section is good to merge. But one thing, While logging out, Both cookies isLoggedIn and Token should be deleted, failing either one may result in inconsistent results while conditional rendering. Because footer only checks isLoggedIn cookie, so even if there is no Token cookie but there is isLoggedIn cookie, it still considers it as logged in.

Copy link
Member

Choose a reason for hiding this comment

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

The Login and the usertype works fine when normally logging in. Google authentication won't work just yet - so please stay tuned. You can learn more about that in this issue.

The token is an HTTP-only cookie - so you won't be able to access the cookie from the front end. So checking for the Token cookie makes no sense. Currently, we might have some glitch in the backend where the logout function fails to clear the cookies in production - but it should work properly in the local.

image

@tamalCodes tamalCodes removed the deployed This PR has been deployed to Vercel for testing. label Oct 7, 2023
src/assets/data/ApiEndpoints.js Outdated Show resolved Hide resolved
@github-actions
Copy link

This pull request has been deployed to Vercel.

Latest commit: 72b4be2
✅ Preview: https://milan-e9pobgcz1-iamtamal.vercel.app
🔍 Inspect: https://vercel.com/iamtamal/milan/21jxE1HhEvaGCfWvv9h2AHFASqfE

View Workflow Logs

Copy link
Member

@tamalCodes tamalCodes left a comment

Choose a reason for hiding this comment

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

Amazing work 🎉

The changes look good to me and will be merged soon.

Do follow Tamal for more Opensource fun projects and don't forget to drop a star so that you get updated about our latest releases (we will tag you and mention your work) and also a shoutout on social media (LinkedIn and Twitter) !

Happy Opensource 🚀.

@tamalCodes tamalCodes added status: ready ✅ This PR has passed all the checks and is now ready to be merged. hacktoberfest-accepted This PR is accepted for Hacktoberfest. and removed area/logic This issue is related to a logic fix. status: need changes 🚧 Changes have been requested for these PRs labels Oct 16, 2023
@tamalCodes tamalCodes merged commit fc2a191 into ngoworldcommunity:main Oct 16, 2023
4 checks passed
@YuvarajSingh-0
Copy link
Member Author

YuvarajSingh-0 commented Oct 16, 2023

It's been great contributing this project, I apologise for the delay in resolving this small issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug This is a patch, generally fixing some bugs. hacktoberfest-accepted This PR is accepted for Hacktoberfest. status: ready ✅ This PR has passed all the checks and is now ready to be merged.
Projects
Status: Merged/Discarded
Development

Successfully merging this pull request may close these issues.

Bug: Problem in Footer after Logging In
2 participants