Skip to content

Commit 02982c5

Browse files
Leo6Leoopenshift-cherrypick-robot
authored andcommitted
Merge pull request openshift#15523 from Leo6Leo/leo/ocpbugs/62083/4-19/auth-error-page
[release-4.19] OCPBUGS-62083: `/auth/error?error=missing_state&error_type=auth` is showing blank page
1 parent b7a6552 commit 02982c5

File tree

3 files changed

+34
-18
lines changed

3 files changed

+34
-18
lines changed

frontend/public/components/app.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ const AppRouter = () => {
296296
<Router history={history} basename={window.SERVER_FLAGS.basePath}>
297297
<CompatRouter>
298298
<Routes>
299-
<Route path={LOGIN_ERROR_PATH} component={AuthenticationErrorPage} />
299+
<Route path={LOGIN_ERROR_PATH} element={<AuthenticationErrorPage />} />
300300
{standaloneRouteExtensions.map((e) => (
301301
<Route
302302
key={e.uid}

frontend/public/components/error.tsx

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import {
1111
StackItem,
1212
EmptyStateHeader,
1313
EmptyStateActions,
14+
EmptyStateFooter,
1415
Icon,
16+
Button,
1517
Title,
1618
} from '@patternfly/react-core';
1719
import { ExclamationCircleIcon } from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
@@ -99,20 +101,28 @@ const LoginErrorMessage: React.FC = () => {
99101
case 'login_state_error':
100102
return t('public~There was an error generating login state.');
101103
case 'cookie_error':
102-
return t('public~There was an error setting login state cookie');
103-
case 'missing_code':
104-
return t('public~Auth code is missing in query param.');
105-
case 'missing_state':
106-
return t('public~There was an error parsing your state cookie');
107-
case 'invalid_code':
108-
return t('public~There was an error logging you in. Please log out and try again.');
109-
case 'invalid_state':
110-
return t('public~There was an error verifying your session. Please log out and try again.');
104+
return t('public~There was an error setting login state cookie.');
111105
case 'logout_error':
112106
return t('public~There was an error logging you out. Please try again.');
107+
case 'auth':
108+
// When the error type is set as auth
109+
switch (error) {
110+
case 'missing_state':
111+
return t('public~There was an error parsing your state cookie.');
112+
case 'invalid_state':
113+
return t(
114+
'public~There was an error verifying your session. Please log out and try again.',
115+
);
116+
case 'missing_code':
117+
return t('public~Auth code is missing in query param.');
118+
case 'invalid_code':
119+
return t('public~There was an error logging you in. Please log out and try again.');
120+
default:
121+
return t('public~There was an authentication error. Please log out and try again.');
122+
}
113123
default:
114124
return (
115-
<Trans>
125+
<Trans ns="public">
116126
There was an authentication error with the system:
117127
<CodeBlock>
118128
<CodeBlockCode>{error}</CodeBlockCode>
@@ -125,6 +135,7 @@ const LoginErrorMessage: React.FC = () => {
125135
export const AuthenticationErrorPage: React.FC = () => {
126136
const { t } = useTranslation();
127137
const title = t('public~Authentication error');
138+
128139
return (
129140
<>
130141
<Helmet>
@@ -143,9 +154,13 @@ export const AuthenticationErrorPage: React.FC = () => {
143154
</StackItem>
144155
</Stack>
145156
</EmptyStateBody>
146-
<EmptyStateActions>
147-
<a href="/logout">{t('public~Try again')}</a>
148-
</EmptyStateActions>
157+
<EmptyStateFooter>
158+
<EmptyStateActions>
159+
<Button component="a" variant="primary" href="/">
160+
{t('public~Try again')}
161+
</Button>
162+
</EmptyStateActions>
163+
</EmptyStateFooter>
149164
</EmptyState>
150165
</>
151166
);

frontend/public/locales/en/public.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,12 +514,13 @@
514514
"There was a problem processing the request. Please try again.": "There was a problem processing the request. Please try again.",
515515
"There was an error generating OAuth client from OIDC client.": "There was an error generating OAuth client from OIDC client.",
516516
"There was an error generating login state.": "There was an error generating login state.",
517-
"There was an error setting login state cookie": "There was an error setting login state cookie",
517+
"There was an error setting login state cookie.": "There was an error setting login state cookie.",
518+
"There was an error logging you out. Please try again.": "There was an error logging you out. Please try again.",
519+
"There was an error parsing your state cookie.": "There was an error parsing your state cookie.",
520+
"There was an error verifying your session. Please log out and try again.": "There was an error verifying your session. Please log out and try again.",
518521
"Auth code is missing in query param.": "Auth code is missing in query param.",
519-
"There was an error parsing your state cookie": "There was an error parsing your state cookie",
520522
"There was an error logging you in. Please log out and try again.": "There was an error logging you in. Please log out and try again.",
521-
"There was an error verifying your session. Please log out and try again.": "There was an error verifying your session. Please log out and try again.",
522-
"There was an error logging you out. Please try again.": "There was an error logging you out. Please try again.",
523+
"There was an authentication error. Please log out and try again.": "There was an authentication error. Please log out and try again.",
523524
"There was an authentication error with the system:<1><0>{error}</0></1>": "There was an authentication error with the system:<1><0>{error}</0></1>",
524525
"Authentication error": "Authentication error",
525526
"Try again": "Try again",

0 commit comments

Comments
 (0)