Generalise error display (#978)

This commit is contained in:
Aswin V 2023-03-02 16:11:34 +05:30 committed by GitHub
parent 94d3c5fd9b
commit 54bd0467de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View File

@ -61,7 +61,7 @@
"server_error": "server error",
"sign_out": "Sign out",
"saml": "SAML",
"saml_error": "SAML error",
"sso_error": "SSO error",
"scim_endpoint": "SCIM Endpoint",
"scim_token": "SCIM Token",
"select_type": "Select Type",

View File

@ -73,8 +73,11 @@ export class SAMLHandler {
});
}
const noSSOConnectionErrMessage =
authFlow === 'oauth' ? 'No SSO connection found.' : 'No SAML connection found.';
if (!connections || connections.length === 0) {
throw new JacksonError('No SAML connection found.', 404);
throw new JacksonError(noSSOConnectionErrMessage, 404);
}
// If an IdP is specified, find the connection for that IdP
@ -82,7 +85,7 @@ export class SAMLHandler {
const connection = connections.find((c) => c.clientID === idp_hint);
if (!connection) {
throw new JacksonError('No SAML connection found.', 404);
throw new JacksonError(noSSOConnectionErrMessage, 404);
}
return { connection };

View File

@ -47,7 +47,9 @@ export default function Error() {
<p className='mb-4 text-3xl font-bold tracking-tight text-gray-900 dark:text-white md:text-4xl'>
{statusText}
</p>
<p className='mb-4 text-lg font-light'>{t('saml_error')}: {message}</p>
<p className='mb-4 text-lg font-light'>
{t('sso_error')}: {message}
</p>
</div>
</div>
</section>