diff --git a/app/scenes/Login/components/Notices.tsx b/app/scenes/Login/components/Notices.tsx index dd4c7e8c69..5622d7e3d1 100644 --- a/app/scenes/Login/components/Notices.tsx +++ b/app/scenes/Login/components/Notices.tsx @@ -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 ( + + The domain associated with your email address has not been allowed for + this workspace. + + ); + case "domain-required": + return ( + + Unable to sign-in. Please navigate to your workspace's custom URL, + then try to sign-in again. +
+ If you were invited to a workspace, you will find a link to it in the + invite email. +
+ ); + case "gmail-account-creation": + return ( + + Sorry, a new account cannot be created with a personal Gmail address. +
+ Please use a Google Workspaces account instead. +
+ ); + case "pending-deletion": + return ( + + The workspace associated with your user is scheduled for deletion and + cannot be accessed at this time. + + ); + case "maximum-reached": + return ( + + The workspace you authenticated with is not authorized on this + installation. Try another? + + ); + case "malformed-user-info": + return ( + + We could not read the user info supplied by your identity provider. + + ); + case "email-auth-required": + return ( + + Your account uses email sign-in, please sign-in with email to + continue. + + ); + case "email-auth-ratelimit": + return ( + + An email sign-in link was recently sent, please check your inbox or + try again in a few minutes. + + ); + case "auth-error": + case "state-mismatch": + return ( + + Authentication failed – we were unable to sign you in at this time. + Please try again. + + ); + case "invalid-authentication": + return ( + + Authentication failed – you do not have permission to access this + workspace. + + ); + case "expired-token": + return ( + + Sorry, it looks like that sign-in link is no longer valid, please try + requesting another. + + ); + case "user-suspended": + return ( + + Your account has been suspended. To re-activate your account, please + contact a workspace admin. + + ); + case "team-suspended": + return ( + + This workspace has been suspended. Please contact support to restore + access. + + ); + case "authentication-provider-disabled": + return ( + + Authentication failed – this login method was disabled by a team + admin. + + ); + case "invite-required": + return ( + + The workspace you are trying to join requires an invite before you can + create an account. +
+ Please request an invite from your workspace admin and try again. +
+ ); + default: + return Sorry, an unknown error occurred.; + } +} + export default function Notices() { const query = useQuery(); const notice = query.get("notice"); @@ -15,107 +133,7 @@ export default function Notices() { return ( }> - {notice === "domain-not-allowed" && ( - - The domain associated with your email address has not been allowed for - this workspace. - - )} - {notice === "domain-required" && ( - - Unable to sign-in. Please navigate to your workspace's custom URL, - then try to sign-in again. -
- If you were invited to a workspace, you will find a link to it in the - invite email. -
- )} - {notice === "gmail-account-creation" && ( - - Sorry, a new account cannot be created with a personal Gmail address. -
- Please use a Google Workspaces account instead. -
- )} - {notice === "pending-deletion" && ( - - The workspace associated with your user is scheduled for deletion and - cannot be accessed at this time. - - )} - {notice === "maximum-reached" && ( - - The workspace you authenticated with is not authorized on this - installation. Try another? - - )} - {notice === "malformed-user-info" && ( - - We could not read the user info supplied by your identity provider. - - )} - {notice === "email-auth-required" && ( - - Your account uses email sign-in, please sign-in with email to - continue. - - )} - {notice === "email-auth-ratelimit" && ( - - An email sign-in link was recently sent, please check your inbox or - try again in a few minutes. - - )} - {(notice === "auth-error" || notice === "state-mismatch") && ( - - Authentication failed – we were unable to sign you in at this time. - Please try again. - - )} - {notice === "invalid-authentication" && ( - - Authentication failed – you do not have permission to access this - workspace. - - )} - {notice === "expired-token" && ( - - Sorry, it looks like that sign-in link is no longer valid, please try - requesting another. - - )} - {notice === "user-suspended" && ( - - Your account has been suspended. To re-activate your account, please - contact a workspace admin. - - )} - {notice === "team-suspended" && ( - - This workspace has been suspended. Please contact support to restore - access. - - )} - {notice === "authentication-provider-disabled" && ( - - Authentication failed – this login method was disabled by a team - admin. - - )} - {notice === "invite-required" && ( - - The workspace you are trying to join requires an invite before you can - create an account. -
- Please request an invite from your workspace admin and try again. -
- )} - {notice === "domain-not-allowed" && ( - - Sorry, your domain is not allowed. Please try again with an allowed - workspace domain. - - )} +
); } diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json index 292bd361ff..050acdc59b 100644 --- a/shared/i18n/locales/en_US/translation.json +++ b/shared/i18n/locales/en_US/translation.json @@ -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>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>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.",