-
Notifications
You must be signed in to change notification settings - Fork 699
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
Redirect user when loading class summary results in 403 #12755
base: develop
Are you sure you want to change the base?
Redirect user when loading class summary results in 403 #12755
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a fairly drastic change in existing behaviour. The issue asked for the authentication wrapper to be used in the quiz creation flow, not to globally alter behaviour on permission failure.
// done to gracefully handle the case that an admin is signed out due to | ||
// timeout while in Coach and when a Learner signs in, they are returned | ||
// to the URL the admin was previously on and hit this 403 | ||
redirectBrowser(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not fixing the issue as described - the mismatch in the behaviour was specifically in the quiz creation page, where it is not using the authentication wrapper component to show meaningful errors to the user in the case that they are not authenticted.
Also, as this is now applying to every page in coach, the existing authentication wrapper errors may not show because of this.
Further, if a coach's session expired, and the classSummary API update call returned early, they would now get redirected to the login page, but without a next
parameter to guide them back to where they were before.
Build Artifacts
|
b11c898
to
c8a6c37
Compare
Learner is still being stuck with blank page and 403 in the console 😕 PR-12755.mp4 |
Hrm, looks like it's maybe a race condition? If the class notifications endpoint gives a 403 before the class summary endpoint, we see it stuck, but if the class summary endpoint returns then we see the authentication message properly? |
…uthmessage w/ urls
…g even if an error occurs mid-navigation (for example, like in QuizSummary's beforeRouteEnter)
63243b0
to
3eaa320
Compare
@radinamatic I've updated this PR and tested in coach - the learner user should be navigated to the AuthMessage as expected now. |
Summary
When a coach is doing coach things and they are logged out due to timeout, Kolibri will keep track of the last place the user was in. If a coach is doing coach things, then they timeout, but then a Learner logs in again the Learner is redirected to where the coach previously was.
Since the Learner cannot do Coach things, they get a
403
on the classSummary API call.So we catch that particular error and redirect the user such that they go to wherever they'd normally have gone after logging in.
References
Fixes #12442
Reviewer guidance
kolibri
cookie, see that you are redirected to the sign-in pageBefore the fix:
After the fix:
completelyvirtually unaware that they were initially being redirected to Coach things (unless they're keenly watching the URL bar or their devtools as they are still directed to the Coach URL before being re-redirected)Testing checklist
PR process
Reviewer checklist
yarn
andpip
)