Spaces:
Running
Running
登录提示修复
Browse files- 前端页面/components/用户体验_国际化.js +12 -0
- 前端页面/components/顶部导航组件.js +14 -2
- 前端页面/core/网络请求_基础设施.js +3 -0
前端页面/components/用户体验_国际化.js
CHANGED
|
@@ -288,6 +288,12 @@ const translations = {
|
|
| 288 |
'auth.no_account': '没有账号?',
|
| 289 |
'auth.register_now': '立即注册',
|
| 290 |
'auth.account_password_required': '账号和密码不能为空!',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 291 |
'auth.display_name': '显示名称',
|
| 292 |
'auth.set_password': '设置密码',
|
| 293 |
'auth.security_email': '安全邮箱',
|
|
@@ -1999,6 +2005,12 @@ const translations = {
|
|
| 1999 |
'auth.no_account': 'No account?',
|
| 2000 |
'auth.register_now': 'Register now',
|
| 2001 |
'auth.account_password_required': 'Account and password are required!',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2002 |
'auth.display_name': 'Display Name',
|
| 2003 |
'auth.set_password': 'Set Password',
|
| 2004 |
'auth.security_email': 'Security Email',
|
|
|
|
| 288 |
'auth.no_account': '没有账号?',
|
| 289 |
'auth.register_now': '立即注册',
|
| 290 |
'auth.account_password_required': '账号和密码不能为空!',
|
| 291 |
+
'auth.login_credentials_invalid': '账号或密码错误,请检查后重试。',
|
| 292 |
+
'auth.login_rate_limited': '登录尝试过于频繁,请稍后再试。',
|
| 293 |
+
'auth.login_input_invalid': '登录信息格式不正确,请检查账号和密码。',
|
| 294 |
+
'auth.login_service_unavailable': '登录服务暂时不可用,请稍后再试。',
|
| 295 |
+
'auth.login_timeout': '登录请求超时,请检查网络后重试。',
|
| 296 |
+
'auth.login_failed': '登录未成功,请稍后重试。',
|
| 297 |
'auth.display_name': '显示名称',
|
| 298 |
'auth.set_password': '设置密码',
|
| 299 |
'auth.security_email': '安全邮箱',
|
|
|
|
| 2005 |
'auth.no_account': 'No account?',
|
| 2006 |
'auth.register_now': 'Register now',
|
| 2007 |
'auth.account_password_required': 'Account and password are required!',
|
| 2008 |
+
'auth.login_credentials_invalid': 'Incorrect account or password. Please check and try again.',
|
| 2009 |
+
'auth.login_rate_limited': 'Too many login attempts. Please try again later.',
|
| 2010 |
+
'auth.login_input_invalid': 'Invalid login information. Please check your account and password.',
|
| 2011 |
+
'auth.login_service_unavailable': 'The login service is temporarily unavailable. Please try again later.',
|
| 2012 |
+
'auth.login_timeout': 'The login request timed out. Check your network and try again.',
|
| 2013 |
+
'auth.login_failed': 'Login was unsuccessful. Please try again later.',
|
| 2014 |
'auth.display_name': 'Display Name',
|
| 2015 |
'auth.set_password': 'Set Password',
|
| 2016 |
'auth.security_email': 'Security Email',
|
前端页面/components/顶部导航组件.js
CHANGED
|
@@ -167,8 +167,20 @@ export function createTopNav() {
|
|
| 167 |
if (updated?.status === 'success') applyProfile(updated.data);
|
| 168 |
else showToast(t('auth.avatar_set_failed'), 'warning');
|
| 169 |
} catch (_) { if (sameLogin()) showToast(t('auth.avatar_set_failed'), 'warning'); }
|
| 170 |
-
} catch (
|
| 171 |
-
if (current()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
}
|
| 173 |
});
|
| 174 |
window.dispatchEvent(new CustomEvent("comfy-route-view", { detail: { view } }));
|
|
|
|
| 167 |
if (updated?.status === 'success') applyProfile(updated.data);
|
| 168 |
else showToast(t('auth.avatar_set_failed'), 'warning');
|
| 169 |
} catch (_) { if (sameLogin()) showToast(t('auth.avatar_set_failed'), 'warning'); }
|
| 170 |
+
} catch (error) {
|
| 171 |
+
if (current()) {
|
| 172 |
+
let messageKey = 'common.error';
|
| 173 |
+
if (formData.type === 'login') {
|
| 174 |
+
messageKey = 'auth.login_failed';
|
| 175 |
+
if (error?.status === 401 || error?.status === 404) messageKey = 'auth.login_credentials_invalid';
|
| 176 |
+
else if (error?.status === 429) messageKey = 'auth.login_rate_limited';
|
| 177 |
+
else if (error?.status === 422) messageKey = 'auth.login_input_invalid';
|
| 178 |
+
else if (error?.status >= 500) messageKey = 'auth.login_service_unavailable';
|
| 179 |
+
else if (error?.code === 'network_timeout') messageKey = 'auth.login_timeout';
|
| 180 |
+
else if (error?.code === 'network_unavailable' || error?.name === 'CloudUnavailableError') messageKey = 'common.network_error_retry';
|
| 181 |
+
}
|
| 182 |
+
showToast(t(messageKey), 'error'); updateUserButtonState();
|
| 183 |
+
}
|
| 184 |
}
|
| 185 |
});
|
| 186 |
window.dispatchEvent(new CustomEvent("comfy-route-view", { detail: { view } }));
|
前端页面/core/网络请求_基础设施.js
CHANGED
|
@@ -533,12 +533,14 @@ async function request(endpoint, options = {}) {
|
|
| 533 |
// 都重复访问一次;普通 500 仍只视为单接口服务端错误。
|
| 534 |
if ([502, 503, 504].includes(response.status)) {
|
| 535 |
lastError = new Error(errorMsg);
|
|
|
|
| 536 |
networkLevelFailure = true;
|
| 537 |
markCloudDown(endpoint);
|
| 538 |
break;
|
| 539 |
}
|
| 540 |
|
| 541 |
lastError = new Error(errorMsg);
|
|
|
|
| 542 |
continue; // 5xx 错误重试
|
| 543 |
}
|
| 544 |
|
|
@@ -606,6 +608,7 @@ async function request(endpoint, options = {}) {
|
|
| 606 |
lastError = isTimeout
|
| 607 |
? new Error('网络请求超时,请检查网络连接')
|
| 608 |
: new Error('网络连接失败,请检查网络');
|
|
|
|
| 609 |
if (fetchStarted) networkLevelFailure = true;
|
| 610 |
// ☁️ 连接层失败(被墙 / DNS 污染 / 拒绝连接 / 证书错误)几乎不会是偶发抖动,
|
| 611 |
// 打上冷却后其它界面与轮询就不用再各自烧一遍预算。但单次失败不足以定论,
|
|
|
|
| 533 |
// 都重复访问一次;普通 500 仍只视为单接口服务端错误。
|
| 534 |
if ([502, 503, 504].includes(response.status)) {
|
| 535 |
lastError = new Error(errorMsg);
|
| 536 |
+
lastError.status = response.status;
|
| 537 |
networkLevelFailure = true;
|
| 538 |
markCloudDown(endpoint);
|
| 539 |
break;
|
| 540 |
}
|
| 541 |
|
| 542 |
lastError = new Error(errorMsg);
|
| 543 |
+
lastError.status = response.status;
|
| 544 |
continue; // 5xx 错误重试
|
| 545 |
}
|
| 546 |
|
|
|
|
| 608 |
lastError = isTimeout
|
| 609 |
? new Error('网络请求超时,请检查网络连接')
|
| 610 |
: new Error('网络连接失败,请检查网络');
|
| 611 |
+
lastError.code = isTimeout ? 'network_timeout' : 'network_unavailable';
|
| 612 |
if (fetchStarted) networkLevelFailure = true;
|
| 613 |
// ☁️ 连接层失败(被墙 / DNS 污染 / 拒绝连接 / 证书错误)几乎不会是偶发抖动,
|
| 614 |
// 打上冷却后其它界面与轮询就不用再各自烧一遍预算。但单次失败不足以定论,
|