From 4e2c24bdcabd90af5e001be4570d443001bd238a Mon Sep 17 00:00:00 2001 From: DiheChen Date: Sun, 8 Nov 2026 22:48:13 +0800 Subject: [PATCH] fix: reload after signing out an expired account session and check password lengths --- web/src/features/settings/account-section.tsx | 9 +- .../features/settings/profile-store.test.ts | 132 ++++++++++++++++++ 2 files changed, 139 insertions(+), 2 deletions(-) create mode 100644 web/src/features/settings/profile-store.test.ts diff --git a/web/src/features/settings/account-section.tsx b/web/src/features/settings/account-section.tsx index 8eb6504..0f7fc38 100644 --- a/web/src/features/settings/account-section.tsx +++ b/web/src/features/settings/account-section.tsx @@ -41,6 +41,11 @@ export function AccountSection() { switchIdentity(null) } catch (error) { + // 账号在这台设备上的会话已经失效,客户端也已经换成新的游客,退出登录的目的已经达到。 + if (error instanceof IdentityRenewedError) { + window.location.reload() + return + } notificationStore.error(errorMessage(error)) setBusy(false) } @@ -160,7 +165,7 @@ function PasswordDialog({ onClose }: { onClose: () => void }) { onClose() } catch (error) { - notificationStore.error(error instanceof IdentityRenewedError ? '密码没有修改,再试一次。' : errorMessage(error, { INVALID_ARGUMENT: '新密码要 8 到 128 位。' })) + notificationStore.error(error instanceof IdentityRenewedError ? '密码没有修改,再试一次。' : errorMessage(error, { INVALID_ARGUMENT: '密码要 8 到 128 位。' })) setBusy(false) } } @@ -169,7 +174,7 @@ function PasswordDialog({ onClose }: { onClose: () => void }) {
submitted(event, submit)}>