fix(uds-auth): keep login error codes on QR login, name the scanned empNo (0.3.17)
Some checks are pending
ci / test (push) Waiting to run
ci / test-postgresql (push) Waiting to run

0.3.16 mapped every post-scan failure to login_finalize_failed, hiding
codes with their own message (bootstrap_required, account_disabled,
registration_closed). Pass those through again and only fall back for
unknown errors.

The bootstrap_required message now includes the scanned employee number
and how to proceed (UDS_AUTH_INITIAL_ADMIN or emergency account login).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
oliver 2026-10-12 14:24:11 +08:00
parent 08a5520791
commit e61f9c6336
4 changed files with 21 additions and 6 deletions

View file

@ -48,4 +48,13 @@ describe('upstream error messages', () => {
assert.equal(client.split(`"err.${code}":`).length - 1, 2, code)
}
})
it('bootstrap_required names the scanned employee number and the way out', () => {
for (const locale of ['zh', 'en']) {
const m = apiError('bootstrap_required', locale, { empNo: '10012345' })
assert.equal(m.error, 'bootstrap_required')
assert.match(m.message, /UDS_AUTH_INITIAL_ADMIN=10012345/)
assert.doesNotMatch(m.message, /\{empNo\}/)
}
})
})