feat(manager): v2 sign-in (login modes, support access, license notice) and an unlock endpoint for the lock screen
Platform-v2 step 2.6b:
- backend: POST /api/auth/unlock {pin|password} checks the CURRENT session's
user and keeps the session (no new login/token); 5 wrong tries end it
(auth.wrong_pin with attempts_left, then auth.session_ended); bootstrap
gains `login` (manager_mode, autofill_username, support)
- manager LoginPage rewritten on @xenia/ui + i18n: client "manager", password
or PIN pad per setting, remembered/only account card, support access panel
(challenge -> code -> 4 h session, not remembered as an account), notice
when the license runs the free tier (expired/inactive/locked/clock/unverified)
- lock screen on /api/auth/unlock with the shared PinPad
- @xenia/ui PinPad: variable length (minLength/maxLength, OK key, Enter)
- e2e manager.mjs: 33 checks (+ lockout after 5 wrong PINs, PIN login mode,
support access with a wrong then right code)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { test } from 'node:test'
|
||||
import { nextPin, pinAction } from '../src/components/pin.js'
|
||||
import { canSubmit, nextPin, pinAction } from '../src/components/pin.js'
|
||||
|
||||
test('keys map to actions', () => {
|
||||
assert.deepEqual(pinAction('7'), { type: 'digit', digit: '7' })
|
||||
assert.deepEqual(pinAction('Enter'), { type: 'submit' })
|
||||
assert.deepEqual(pinAction('Backspace'), { type: 'backspace' })
|
||||
assert.deepEqual(pinAction('Delete'), { type: 'backspace' })
|
||||
for (const k of ['a', 'Enter', 'Escape', ' ', '12', '']) assert.equal(pinAction(k), null, k)
|
||||
for (const k of ['a', 'Escape', ' ', '12', '']) assert.equal(pinAction(k), null, k)
|
||||
})
|
||||
|
||||
test('digits stop at the length', () => {
|
||||
@@ -21,3 +22,11 @@ test('backspace and clear', () => {
|
||||
assert.equal(nextPin('123', { type: 'clear' }, 4), '')
|
||||
assert.equal(nextPin('12', null, 4), '12')
|
||||
})
|
||||
|
||||
test('variable length: submit only from minLength, digits stop at maxLength', () => {
|
||||
assert.equal(canSubmit('123', 4), false)
|
||||
assert.equal(canSubmit('1234', 4), true)
|
||||
let v = ''
|
||||
for (const k of '1234567890') v = nextPin(v, pinAction(k), 8)
|
||||
assert.equal(v, '12345678')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user