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

Properly redirect on authentication failure #12414

Merged
merged 2 commits into from
Jul 12, 2024

Conversation

rtibbles
Copy link
Member

@rtibbles rtibbles commented Jul 3, 2024

Summary

  • Reorder authentication classes for consistent dev and production errors.
  • Check user_id not id for forbidden redirects.
  • When redirecting a user because they were logged out, persist a next parameter to return them to the last page they were on before logout

References

Fixes #11773

Reviewer guidance

Delete your session cookie while on the quiz creation page, make sure you get properly redirected there and back again.


Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

PR process

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@rtibbles rtibbles added the TODO: needs review Waiting for review label Jul 3, 2024
@github-actions github-actions bot added DEV: backend Python, databases, networking, filesystem... DEV: frontend labels Jul 3, 2024
@radinamatic
Copy link
Member

This is now fixed in all steps of the quiz creation process, and it redirects properly upon session end (tested in Firefox on Ubuntu).

redirect.mp4

@pcenov Could you do some additional checks with Chrome on other coach user workflows? Thank you!

@radinamatic radinamatic requested a review from pcenov July 11, 2024 13:08
Copy link
Member

@radinamatic radinamatic left a comment

Choose a reason for hiding this comment

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

Quiz creation redirect when session ends is a go! 👏🏽

Let's test redirects on some more coach workflows before we give a final approval 🙂

Copy link
Member

@marcellamaki marcellamaki left a comment

Choose a reason for hiding this comment

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

The code changes here seem correct to me, and my own manual QA when running the dev server did properly redirect me out of coach when doing quiz creation.

I'll wait for some final checks from Peter though, per Radina's comment.

@pcenov
Copy link
Member

pcenov commented Jul 11, 2024

Hi @marcellamaki - I noticed two possible follow-up issues if we want to dig deeper in this:

  1. When my session has ended while I've been editing a quiz then I am brought back to the sign-in page where I can sign in as a learner user in which case I am redirected back to the quiz editing page and since I don't actually have permissions to see it I am getting a blank screen:
learner.mp4
  1. If as a coach I've made some changes to the quiz without saving them, then when I sign in they are lost (which is fine in that case) however the contents of the first section are also not displayed until I click on the section tab, which can be confusing:
coach.mp4

@rtibbles
Copy link
Member Author

I think issue 2 has been independently resolved by @nucleogenesis elsewhere. Issue 1 can be filed as a follow up.

@rtibbles rtibbles merged commit c445798 into learningequality:develop Jul 12, 2024
30 checks passed
@rtibbles rtibbles deleted the verboten branch July 12, 2024 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DEV: backend Python, databases, networking, filesystem... DEV: frontend TODO: needs review Waiting for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quiz creation route not redirecting to user_auth on 401/403
4 participants