freeCodeCamp / classroom

BSD 3-Clause "New" or "Revised" License
145 stars 119 forks source link

Unauthorized access to the /classes page should show a more descriptive error message #497

Open utsab opened 8 months ago

utsab commented 8 months ago

Describe the bug When an unauthorized user (not a "TEACHER") clicks on the "classes" link, the app redirects to a blank page.

To Reproduce Steps to reproduce the behavior:

  1. Click "Sign in"
  2. Sign in with Github
  3. The app will redirect you back to the homepage
  4. On your terminal, run the command "npx prisma studio"
  5. In Prisma Studio, open the "User" table. Confirm that your user has a role of "NONE".
  6. Back on the homepage of the Classroom app, click on "Classes". The resulting page will be totally blank.

Expected behavior We should see a more descriptive error message that says "Access Denied". The browser should redirect to the /error page.

Screenshots Current behavior (blank screen): Screen Shot 2023-10-19 at 8 40 46 PM

Expected behavior: Screen Shot 2023-10-19 at 8 40 25 PM

Additional context I am using Github Codespaces (Linux) to reproduce this issue.

utsab commented 8 months ago

We are reserving this issue for the CTI-CodeDay Micro-internship students.

dyluri commented 8 months ago

This issue is reproducible without signing in either. Should both cases redirect to the error page?

dyluri commented 8 months ago

If you were to change the menu button on the nav bar to send you to /admin instead, this same behavior occurs. Refreshing the page seems to get the redirect to work again for both /classes and /admin