From 31553530b768da3e857ec0d3952d9e7b7a4149fd Mon Sep 17 00:00:00 2001 From: smail Date: Wed, 30 Sep 2026 21:47:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BF=AE=E6=94=B9=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E5=90=8E=E7=99=BB=E5=BD=95=E8=B7=B3=E8=BD=AC=E5=B9=B6?= =?UTF-8?q?=E8=A1=A5=E9=BD=90=E4=B8=89=E7=A7=8D=E8=A7=92=E8=89=B2=E5=9B=9E?= =?UTF-8?q?=E5=BD=92=E6=96=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/components/SecuritySettings/SecuritySettings.js | 2 +- test/frontend/password-change.test.mjs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/components/SecuritySettings/SecuritySettings.js b/frontend/src/views/components/SecuritySettings/SecuritySettings.js index 710f797..71b388f 100644 --- a/frontend/src/views/components/SecuritySettings/SecuritySettings.js +++ b/frontend/src/views/components/SecuritySettings/SecuritySettings.js @@ -374,7 +374,7 @@ export function usePage() { passwordChallenge.value = '' notify('密码修改成功,请重新登录;原安全凭据已失效', 'success') globalStatus.clear() - location.assign('/login') + location.assign('/#/login') } catch (error) { notify(error?.message || '密码修改失败,请重新获取验证码后重试') } finally { diff --git a/test/frontend/password-change.test.mjs b/test/frontend/password-change.test.mjs index 3d0cd9a..b184c9f 100644 --- a/test/frontend/password-change.test.mjs +++ b/test/frontend/password-change.test.mjs @@ -45,17 +45,19 @@ test('超级管理员凭邮箱验证码修改密码,成功后清除身份并 assert.equal(calls[1].body.challenge_id, 'challenge') assert.equal(calls[1].body.current_password, undefined) assert.equal(calls[1].body.code, '12345678') - assert.deepEqual(redirects, ['/login']) + assert.deepEqual(redirects, ['/#/login']) assert.equal(Object.keys(store.userInfos).length, 0) }) test('普通用户和管理员维持当前密码验证', async () => { for (const role of ['user', 'admin']) { - const { page, calls } = fixture(role) + const { page, calls, redirects, store } = fixture(role) page.ruleForm.current_pwd = 'OldPass123' await page.submit() assert.equal(calls[0].body.current_password, 'OldPass123') assert.equal(calls[0].body.code, undefined) + assert.deepEqual(redirects, ['/#/login']) + assert.equal(Object.keys(store.userInfos).length, 0) } })