Skip to content

Conversation

@Amogh-Nivaskar
Copy link
Contributor

What does this PR do?

Right now, a user can access the dashboard and its child routes even when he/she is not logged in. This PR makes it so that the user is redirected to the sign in page when he/she tries to access such protected routes when not logged in.

Fixes #102

Video Demonstration of Fix:
https://www.loom.com/share/db79fbd897354415a80f8e11b8a83612?sid=7b0e9869-dee5-4d20-8da4-b87aef7cfe43

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How should this be tested?

  1. Logout if you are already logged in.
  2. Try to access a protected route like: http://app.localhost:3000/dashboard
    You should now get redirected to the sign in page
  3. Now login or sign up
  4. Now from the Application tab in the Dev tools, go to local storage and change the value of the authorization token to make it incorrect. This is to simulate the expiration of the authorization token.
  5. Again try to access a protected route. You should be redirected to login page again, since you now have incorrect credentials

Mandatory Tasks

  • Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.

Checklist

  • My code doesn't follow the style guidelines of this project
  • I haven't commented my code, particularly in hard-to-understand areas
  • I haven't checked if my PR needs changes to the documentation
  • I haven't checked if my changes generate no new warnings
  • I haven't added tests that prove my fix is effective or that my feature works
  • I haven't checked if new and existing unit tests pass locally with my changes

@github-actions
Copy link

github-actions bot commented Oct 9, 2023

Thank you for following the naming conventions! 🙏

@Amogh-Nivaskar Amogh-Nivaskar changed the title fix/Add redirecting to SignIn page when accessing protected route with incorrect credentials fix: Add redirecting to SignIn page when accessing protected route with incorrect credentials Oct 9, 2023
Copy link
Collaborator

@hemantwasthere hemantwasthere left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@hemantwasthere
Copy link
Collaborator

But as this issue has been already solved in PR #92 so we might not merge this!
Thanks for your contribution 😊

@github-actions
Copy link

Hey there, there is a merge conflict, can you take a look?

@github-actions github-actions bot added the 🚨 merge conflict Merge Conflict label Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚨 merge conflict Merge Conflict

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Can access dashboard, even when not logged in

2 participants