feat(waiter): sign-in v2 on the phones (platform-v2 step 4.2)
- Login follows auth.waiter_login_mode / auth.waiter_require_username from the
bootstrap: name + PIN, name + password, typed username, or a "paired screens
only" message for tap mode. POST /api/auth/login {client: "waiter"}; a miss
shows the translated error without a reload.
- POST /api/auth/login-by-id removed; bootstrap login carries waiter_mode and
waiter_require_username.
- Sign-out ends the session on the server (POST /api/auth/logout), so
single_session_waiter = refuse_new no longer strands a waiter.
- Lock on the phone: menu "Lock", automatic lock / sign-out after inactivity
(security.auto_lock*, auto_logout*), unlock with the PIN in the same session,
lock kept across app restarts (restore() no longer clears it).
- e2e: new waiter.mjs (22 checks) in run-all; android.mjs signs in for real and
locks/unlocks on the emulator; TLS live check waits for the socket; the
rediscovery helper re-attaches to a stale WebView handle.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -57,10 +57,10 @@ def test_wrong_password_and_wrong_app(client, make_user):
|
||||
|
||||
# ── waiter logins ────────────────────────────────────────────────────────────
|
||||
|
||||
def test_waiter_pin_by_id_and_deprecated_endpoint(client, make_user):
|
||||
def test_waiter_pin_by_id(client, make_user):
|
||||
w = make_user(role="waiter")
|
||||
assert client.post("/api/auth/login", json={"client": "waiter", "user_id": w.id, "pin": TEST_PIN}).status_code == 200
|
||||
assert client.post("/api/auth/login-by-id", json={"waiter_id": w.id, "pin": TEST_PIN}).status_code == 200
|
||||
assert client.post("/api/auth/login-by-id", json={"waiter_id": w.id, "pin": TEST_PIN}).status_code == 404 # removed in 4.2
|
||||
chef = make_user(role="chef")
|
||||
r = client.post("/api/auth/login", json={"client": "waiter", "user_id": chef.id, "pin": TEST_PIN})
|
||||
assert r.json()["error"]["code"] == "auth.client_not_allowed"
|
||||
@@ -217,3 +217,12 @@ def test_idle_days_setting_and_zero_means_never(client, db, make_user, admin_h):
|
||||
_set(client, admin_h, "auth.idle_days", "3")
|
||||
_age(db, 4, user_id=w.id)
|
||||
assert client.get("/api/auth/me", headers=wh).status_code == 401
|
||||
|
||||
|
||||
def test_bootstrap_tells_the_waiter_app_how_to_sign_in(client, admin_h):
|
||||
login = client.get("/api/platform/bootstrap").json()["login"]
|
||||
assert (login["waiter_mode"], login["waiter_require_username"]) == ("pin", False)
|
||||
_set(client, admin_h, "auth.waiter_login_mode", "password")
|
||||
_set(client, admin_h, "auth.waiter_require_username", "true")
|
||||
login = client.get("/api/platform/bootstrap").json()["login"]
|
||||
assert (login["waiter_mode"], login["waiter_require_username"]) == ("password", True)
|
||||
|
||||
Reference in New Issue
Block a user