[codex] increase login lock threshold (#984)

* increase login ip lock threshold

* show login lock recovery commands
This commit is contained in:
ekko
2026-05-24 22:36:21 +08:00
committed by GitHub
parent 4176923bac
commit 61b41512d4
13 changed files with 134 additions and 1 deletions
+21
View File
@@ -73,4 +73,25 @@ describe('LoginView password login', () => {
expect(mockSetApiKey).not.toHaveBeenCalled()
expect(mockReplace).not.toHaveBeenCalled()
})
it('shows the reset command hint when the login IP is locked', async () => {
const err: any = new Error('Too many login attempts')
err.status = 429
mockLoginWithPassword.mockRejectedValue(err)
const wrapper = mount(LoginView)
const inputs = wrapper.findAll('input.login-input')
await inputs[0].setValue('admin')
await inputs[1].setValue('123456')
await wrapper.find('form.login-form').trigger('submit')
expect(wrapper.find('.login-error').text()).toBe('login.tooManyAttempts')
expect(wrapper.find('.login-lock-hint').text()).toContain('login.lockResetHint')
expect(wrapper.find('.login-lock-hint').text()).toContain('login.defaultLoginResetHint')
const commands = wrapper.findAll('.login-lock-hint code').map(command => command.text())
expect(commands).toEqual([
'hermes-web-ui clear-login-locks --restart',
'hermes-web-ui reset-default-login',
])
})
})