mirror of
https://github.com/outline/outline.git
synced 2026-11-22 05:51:43 +03:00
fix: Improve handling of unknown errors – closes #7933
This commit is contained in:
1 parent
acf3d7cd08
commit
bb43c24efe
2 files changed
+120
-102
No files matched your search
@@ -5,6 +5,124 @@ import { Trans } from "react-i18next";
|
||||
import Notice from "~/components/Notice";
|
||||
import useQuery from "~/hooks/useQuery";
|
||||
|
||||
function Message({ notice }: { notice: string }) {
|
||||
switch (notice) {
|
||||
case "domain-not-allowed":
|
||||
return (
|
||||
<Trans>
|
||||
The domain associated with your email address has not been allowed for
|
||||
this workspace.
|
||||
</Trans>
|
||||
);
|
||||
case "domain-required":
|
||||
return (
|
||||
<Trans>
|
||||
Unable to sign-in. Please navigate to your workspace's custom URL,
|
||||
then try to sign-in again.
|
||||
<hr />
|
||||
If you were invited to a workspace, you will find a link to it in the
|
||||
invite email.
|
||||
</Trans>
|
||||
);
|
||||
case "gmail-account-creation":
|
||||
return (
|
||||
<Trans>
|
||||
Sorry, a new account cannot be created with a personal Gmail address.
|
||||
<hr />
|
||||
Please use a Google Workspaces account instead.
|
||||
</Trans>
|
||||
);
|
||||
case "pending-deletion":
|
||||
return (
|
||||
<Trans>
|
||||
The workspace associated with your user is scheduled for deletion and
|
||||
cannot be accessed at this time.
|
||||
</Trans>
|
||||
);
|
||||
case "maximum-reached":
|
||||
return (
|
||||
<Trans>
|
||||
The workspace you authenticated with is not authorized on this
|
||||
installation. Try another?
|
||||
</Trans>
|
||||
);
|
||||
case "malformed-user-info":
|
||||
return (
|
||||
<Trans>
|
||||
We could not read the user info supplied by your identity provider.
|
||||
</Trans>
|
||||
);
|
||||
case "email-auth-required":
|
||||
return (
|
||||
<Trans>
|
||||
Your account uses email sign-in, please sign-in with email to
|
||||
continue.
|
||||
</Trans>
|
||||
);
|
||||
case "email-auth-ratelimit":
|
||||
return (
|
||||
<Trans>
|
||||
An email sign-in link was recently sent, please check your inbox or
|
||||
try again in a few minutes.
|
||||
</Trans>
|
||||
);
|
||||
case "auth-error":
|
||||
case "state-mismatch":
|
||||
return (
|
||||
<Trans>
|
||||
Authentication failed – we were unable to sign you in at this time.
|
||||
Please try again.
|
||||
</Trans>
|
||||
);
|
||||
case "invalid-authentication":
|
||||
return (
|
||||
<Trans>
|
||||
Authentication failed – you do not have permission to access this
|
||||
workspace.
|
||||
</Trans>
|
||||
);
|
||||
case "expired-token":
|
||||
return (
|
||||
<Trans>
|
||||
Sorry, it looks like that sign-in link is no longer valid, please try
|
||||
requesting another.
|
||||
</Trans>
|
||||
);
|
||||
case "user-suspended":
|
||||
return (
|
||||
<Trans>
|
||||
Your account has been suspended. To re-activate your account, please
|
||||
contact a workspace admin.
|
||||
</Trans>
|
||||
);
|
||||
case "team-suspended":
|
||||
return (
|
||||
<Trans>
|
||||
This workspace has been suspended. Please contact support to restore
|
||||
access.
|
||||
</Trans>
|
||||
);
|
||||
case "authentication-provider-disabled":
|
||||
return (
|
||||
<Trans>
|
||||
Authentication failed – this login method was disabled by a team
|
||||
admin.
|
||||
</Trans>
|
||||
);
|
||||
case "invite-required":
|
||||
return (
|
||||
<Trans>
|
||||
The workspace you are trying to join requires an invite before you can
|
||||
create an account.
|
||||
<hr />
|
||||
Please request an invite from your workspace admin and try again.
|
||||
</Trans>
|
||||
);
|
||||
default:
|
||||
return <Trans>Sorry, an unknown error occurred.</Trans>;
|
||||
}
|
||||
}
|
||||
|
||||
export default function Notices() {
|
||||
const query = useQuery();
|
||||
const notice = query.get("notice");
|
||||
@@ -15,107 +133,7 @@ export default function Notices() {
|
||||
|
||||
return (
|
||||
<Notice icon={<WarningIcon color="currentcolor" />}>
|
||||
{notice === "domain-not-allowed" && (
|
||||
<Trans>
|
||||
The domain associated with your email address has not been allowed for
|
||||
this workspace.
|
||||
</Trans>
|
||||
)}
|
||||
{notice === "domain-required" && (
|
||||
<Trans>
|
||||
Unable to sign-in. Please navigate to your workspace's custom URL,
|
||||
then try to sign-in again.
|
||||
<hr />
|
||||
If you were invited to a workspace, you will find a link to it in the
|
||||
invite email.
|
||||
</Trans>
|
||||
)}
|
||||
{notice === "gmail-account-creation" && (
|
||||
<Trans>
|
||||
Sorry, a new account cannot be created with a personal Gmail address.
|
||||
<hr />
|
||||
Please use a Google Workspaces account instead.
|
||||
</Trans>
|
||||
)}
|
||||
{notice === "pending-deletion" && (
|
||||
<Trans>
|
||||
The workspace associated with your user is scheduled for deletion and
|
||||
cannot be accessed at this time.
|
||||
</Trans>
|
||||
)}
|
||||
{notice === "maximum-reached" && (
|
||||
<Trans>
|
||||
The workspace you authenticated with is not authorized on this
|
||||
installation. Try another?
|
||||
</Trans>
|
||||
)}
|
||||
{notice === "malformed-user-info" && (
|
||||
<Trans>
|
||||
We could not read the user info supplied by your identity provider.
|
||||
</Trans>
|
||||
)}
|
||||
{notice === "email-auth-required" && (
|
||||
<Trans>
|
||||
Your account uses email sign-in, please sign-in with email to
|
||||
continue.
|
||||
</Trans>
|
||||
)}
|
||||
{notice === "email-auth-ratelimit" && (
|
||||
<Trans>
|
||||
An email sign-in link was recently sent, please check your inbox or
|
||||
try again in a few minutes.
|
||||
</Trans>
|
||||
)}
|
||||
{(notice === "auth-error" || notice === "state-mismatch") && (
|
||||
<Trans>
|
||||
Authentication failed – we were unable to sign you in at this time.
|
||||
Please try again.
|
||||
</Trans>
|
||||
)}
|
||||
{notice === "invalid-authentication" && (
|
||||
<Trans>
|
||||
Authentication failed – you do not have permission to access this
|
||||
workspace.
|
||||
</Trans>
|
||||
)}
|
||||
{notice === "expired-token" && (
|
||||
<Trans>
|
||||
Sorry, it looks like that sign-in link is no longer valid, please try
|
||||
requesting another.
|
||||
</Trans>
|
||||
)}
|
||||
{notice === "user-suspended" && (
|
||||
<Trans>
|
||||
Your account has been suspended. To re-activate your account, please
|
||||
contact a workspace admin.
|
||||
</Trans>
|
||||
)}
|
||||
{notice === "team-suspended" && (
|
||||
<Trans>
|
||||
This workspace has been suspended. Please contact support to restore
|
||||
access.
|
||||
</Trans>
|
||||
)}
|
||||
{notice === "authentication-provider-disabled" && (
|
||||
<Trans>
|
||||
Authentication failed – this login method was disabled by a team
|
||||
admin.
|
||||
</Trans>
|
||||
)}
|
||||
{notice === "invite-required" && (
|
||||
<Trans>
|
||||
The workspace you are trying to join requires an invite before you can
|
||||
create an account.
|
||||
<hr />
|
||||
Please request an invite from your workspace admin and try again.
|
||||
</Trans>
|
||||
)}
|
||||
{notice === "domain-not-allowed" && (
|
||||
<Trans>
|
||||
Sorry, your domain is not allowed. Please try again with an allowed
|
||||
workspace domain.
|
||||
</Trans>
|
||||
)}
|
||||
<Message notice={notice} />
|
||||
</Notice>
|
||||
);
|
||||
}
|
||||
@@ -790,7 +790,7 @@
|
||||
"This workspace has been suspended. Please contact support to restore access.": "This workspace has been suspended. Please contact support to restore access.",
|
||||
"Authentication failed – this login method was disabled by a team admin.": "Authentication failed – this login method was disabled by a team admin.",
|
||||
"The workspace you are trying to join requires an invite before you can create an account.<1></1>Please request an invite from your workspace admin and try again.": "The workspace you are trying to join requires an invite before you can create an account.<1></1>Please request an invite from your workspace admin and try again.",
|
||||
"Sorry, your domain is not allowed. Please try again with an allowed workspace domain.": "Sorry, your domain is not allowed. Please try again with an allowed workspace domain.",
|
||||
"Sorry, an unknown error occurred.": "Sorry, an unknown error occurred.",
|
||||
"Login": "Login",
|
||||
"Error": "Error",
|
||||
"Failed to load configuration.": "Failed to load configuration.",
|
||||
|
||||
Reference in new issue
Block a user