nicolium: add a CORS warning
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@@ -1416,7 +1416,8 @@
|
||||
"login.otp_log_in.fail": "Invalid code, please try again.",
|
||||
"login.reset_password_hint": "Trouble logging in?",
|
||||
"login.sign_in": "Sign in",
|
||||
"login_external.errors.instance_fail": "The instance returned an error.",
|
||||
"login_external.errors.cors_fail": "Connection failed, likely due to CORS configuration. Is the instance configured to allow logins from other origins?",
|
||||
"login_external.errors.instance_fail": "The instance returned an error. Is the URL correct?",
|
||||
"login_external.errors.network_fail": "Connection failed. Is a browser extension blocking it?",
|
||||
"login_form.divider": "or",
|
||||
"login_form.external": "Sign in from remote instance",
|
||||
|
||||
@@ -13,7 +13,12 @@ const messages = defineMessages({
|
||||
instancePlaceholder: { id: 'login.fields.instance_placeholder', defaultMessage: 'example.com' },
|
||||
instanceFailed: {
|
||||
id: 'login_external.errors.instance_fail',
|
||||
defaultMessage: 'The instance returned an error.',
|
||||
defaultMessage: 'The instance returned an error. Is the URL correct?',
|
||||
},
|
||||
corsFailed: {
|
||||
id: 'login_external.errors.cors_fail',
|
||||
defaultMessage:
|
||||
'Connection failed, likely due to CORS configuration. Is the instance configured to allow logins from other origins?',
|
||||
},
|
||||
networkFailed: {
|
||||
id: 'login_external.errors.network_fail',
|
||||
@@ -47,8 +52,10 @@ const ExternalLoginForm: React.FC = () => {
|
||||
console.error(error);
|
||||
const status = error.response?.status;
|
||||
|
||||
if (status) {
|
||||
if (status || !error.message) {
|
||||
toast.error(intl.formatMessage(messages.instanceFailed));
|
||||
} else if (error.message === 'NetworkError when attempting to fetch resource.') {
|
||||
toast.error(intl.formatMessage(messages.corsFailed));
|
||||
} else if (!status && ['Network request failed', 'Timeout'].includes(error.message)) {
|
||||
toast.error(intl.formatMessage(messages.networkFailed));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user