修复修改密码后登录跳转并补齐三种角色回归断言
Some checks are pending
Security Checks / security (push) Waiting to run

This commit is contained in:
smail 2026-09-30 21:47:34 +08:00
parent 691802f52b
commit 31553530b7
2 changed files with 5 additions and 3 deletions

View File

@ -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 {

View File

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