-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Handle an expired admin user link #17667
Handle an expired admin user link #17667
Conversation
|
||
// Wrap the App in an ErrorBoundary to catch User/Org loading errors | ||
// This will also catch any errors that happen to bubble all the way up to the top | ||
const AppWithErrorBoundary: FC = () => { |
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 was leftover and not needed anymore.
@@ -72,4 +67,13 @@ const App: FC = () => { | |||
); | |||
}; | |||
|
|||
export default AppWithErrorBoundary; | |||
// Routing level above main App component for any routes that don't need user/orgs loaded, such as addressable error pages |
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 adds a layer above our App to let us render things like addressable error pages w/ their own routes. They won't load any external data by default.
return ( | ||
<Suspense fallback={<AppLoading />}> | ||
<Switch> | ||
{/* Matching /error/expired-ots */} |
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.
We can add other addressable error pages here and use them for other cases where the api needs to redirect somewhere to show the user an error.
import cubicleDarkImg from "../images/cubicle-dark.png"; | ||
import cubicleImg2x from "../images/cubicle@2x.png"; | ||
import cubicleDarkImg2x from "../images/cubicle-dark@2x.png"; | ||
import cubicleImg from "../images/cubicle.webp"; |
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.
Switched all these png to webp cause they're waaaaay smaller.
const code = e.code || 401; | ||
res.sendStatus(code); | ||
// Always redirect to an expired token page if there's an error | ||
res.redirect("/error/expired-ots", 307); |
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.
unsure if we want to try and classify different errors, i.e. expired vs. invalid. If so, we can have an error route for each one.
/unhold |
Description
Adds an error page to the admin login flow. I added a layer above our
<App/>
that provides a way to add routes for things like addressable error pages. I've added/error/expired-ots
for this scenario, but anything under/error/*
will resolve to this new routing layer, and render a default error page if we don't have an explicit route for it yet. This will let us add more addressable error pages in the future if we need. The primary intent of these is for scenarios where the api layer needs to redirect somewhere in the case of an error, and let us render clientside to accomplish that. No external data is loaded from the client for this routing layer, such as a user/orgs.Related Issue(s)
Fixes WEB-286
How to test
/error/expired-ots
/error/foo
will render a default error page, mostly to just have a catch-all for any undefined routes underneath the/error/*
path./api/login/ots/admin/badtoken
- it should redirect to the/error/expired-ots
error pageDocumentation
Preview status
Gitpod was successfully deployed to your preview environment.
Build Options:
Run the build with werft instead of GHA
Run Leeway with
--dont-test
Publish Options
Installer Options
Add desired feature flags to the end of the line above, space separated
Preview Environment Options:
If enabled this will build
install/preview
If enabled this will create the environment on GCE infra
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh
/hold