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) } })