Fix handling incorrect login method errors #2393
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Features and Changes
In the past whenever people logged in via email when they had already once logged in via SSO ProtectedPage handled the error via the error property on UserConext. Errors that occurred during the organization endpoint would resulting in a loading spinner forever. As part of #2339 a new modal was made to handle all errors from the organization endpoint. Unfortunately that new modal didn't have the header tab with the log out, nor enable people to log out again, and that modal took precedence over ProtectedPage, and hence people who log in via email rather than SSO when they have logged in as SSO before, can't log out again to fix the situation.
This change adds any errors that come from the organization endpoint to the error property of the UserContext and hence ProtectedPage will also show any errors there.
It also updates the message to be a clearer reminder to the user to not use email to sign in, in the case they forgot to use SSO.
Testing
In
front-end/.env.local
setIn
back-end/.env.local
setStart the server.
Login via email.
See the logout button.
Logout.
Login via SSO.
See it log in correctly.
.....
In
front-end/.env.local
setIn
back-end/.env.local
setRemove any licenseKey from organization in mongo.
Start the server.
See the error message "Your license does not support SSO. Either upgrade to enterprise or remove SSO_CONFIG environment variable." also with the logout button now.