This commit is contained in:
parent
691802f52b
commit
31553530b7
@ -374,7 +374,7 @@ export function usePage() {
|
|||||||
passwordChallenge.value = ''
|
passwordChallenge.value = ''
|
||||||
notify('密码修改成功,请重新登录;原安全凭据已失效', 'success')
|
notify('密码修改成功,请重新登录;原安全凭据已失效', 'success')
|
||||||
globalStatus.clear()
|
globalStatus.clear()
|
||||||
location.assign('/login')
|
location.assign('/#/login')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notify(error?.message || '密码修改失败,请重新获取验证码后重试')
|
notify(error?.message || '密码修改失败,请重新获取验证码后重试')
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@ -45,17 +45,19 @@ test('超级管理员凭邮箱验证码修改密码,成功后清除身份并
|
|||||||
assert.equal(calls[1].body.challenge_id, 'challenge')
|
assert.equal(calls[1].body.challenge_id, 'challenge')
|
||||||
assert.equal(calls[1].body.current_password, undefined)
|
assert.equal(calls[1].body.current_password, undefined)
|
||||||
assert.equal(calls[1].body.code, '12345678')
|
assert.equal(calls[1].body.code, '12345678')
|
||||||
assert.deepEqual(redirects, ['/login'])
|
assert.deepEqual(redirects, ['/#/login'])
|
||||||
assert.equal(Object.keys(store.userInfos).length, 0)
|
assert.equal(Object.keys(store.userInfos).length, 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('普通用户和管理员维持当前密码验证', async () => {
|
test('普通用户和管理员维持当前密码验证', async () => {
|
||||||
for (const role of ['user', 'admin']) {
|
for (const role of ['user', 'admin']) {
|
||||||
const { page, calls } = fixture(role)
|
const { page, calls, redirects, store } = fixture(role)
|
||||||
page.ruleForm.current_pwd = 'OldPass123'
|
page.ruleForm.current_pwd = 'OldPass123'
|
||||||
await page.submit()
|
await page.submit()
|
||||||
assert.equal(calls[0].body.current_password, 'OldPass123')
|
assert.equal(calls[0].body.current_password, 'OldPass123')
|
||||||
assert.equal(calls[0].body.code, undefined)
|
assert.equal(calls[0].body.code, undefined)
|
||||||
|
assert.deepEqual(redirects, ['/#/login'])
|
||||||
|
assert.equal(Object.keys(store.userInfos).length, 0)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user