修复注册流程不写入持久化登录态、注册失败500错误显示原始英文
Register组件缺少Login同款的keep-logged-in挂载副作用,导致注册产生的
新账号在下一次刷新时静默丢失会话(无报错、无跳转登录页)。
另外注册走原生WS {acc}协议而非REST,未接入CTRL_ERROR_TEXT_CN翻译表,
"internal error (500)"等错误会原样展示给用户。
第十轮最小粒度测试 Ch1-2 发现。
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
eb4c1cd8da
commit
35f659249e
@@ -177,7 +177,8 @@ const CTRL_ERROR_TEXT_CN = {
|
||||
'authentication required': '请先登录',
|
||||
'unknown authentication scheme': '登录方式不受支持,请刷新页面重试',
|
||||
'policy violation': '当前操作不符合安全策略要求',
|
||||
'permission denied': '没有权限执行此操作,请重新登录'
|
||||
'permission denied': '没有权限执行此操作,请重新登录',
|
||||
'internal error': '服务器繁忙,请稍后重试'
|
||||
};
|
||||
function translateCtrlError(err) {
|
||||
const raw = err && err.message;
|
||||
@@ -1517,7 +1518,15 @@ class TinodeWeb extends React.Component {
|
||||
this.handleLoginSuccessful(this);
|
||||
}
|
||||
}).catch(err => {
|
||||
this.handleError(err.message, 'err');
|
||||
// Registration goes over the native WS {acc} protocol, not REST, so im-api.js's
|
||||
// REASON_MESSAGES translation table (REST-only) never sees this error -- it was showing
|
||||
// raw SDK text like "internal error (500)" verbatim (confirmed live: retrying a phone
|
||||
// number that's already registered). CTRL_ERROR_TEXT_CN already translates this same class
|
||||
// of {ctrl} error for login; reused here with a registration-appropriate fallback instead
|
||||
// of loginErrorMessage's own (its 401/403 fallback is "账号或密码错误", which doesn't fit a
|
||||
// failed registration).
|
||||
const known = translateCtrlError(err);
|
||||
this.handleError(known || (err && err.message) || '注册失败,请稍后重试', 'err');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user