classroom icon indicating copy to clipboard operation
classroom copied to clipboard

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

Open utsab opened this issue 1 year ago • 3 comments

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 avatar Oct 20 '23 03:10 utsab

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

utsab avatar Oct 20 '23 03:10 utsab

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

dyluri avatar Nov 03 '23 02:11 dyluri

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

dyluri avatar Nov 03 '23 23:11 dyluri