Login security
## New sign-in notice (always on)
New sign-in notice (always on)
Every completed sign-in (password, Google/GitHub/GitLab, SAML/OIDC SSO, 2FA, passkey) is checked against the devices the account used before: a random lc_device cookie (HttpOnly, stored only as a SHA-256 hash in known_devices) and the coarse network (IPv4 /24, IPv6 /48, from the trusted proxy's X-Forwarded-For). A new device, or a known device on a new network, emails the account through the auth mail outbox (SMTP) with the browser, network and time. The first device on record is never announced.
Emailed confirmation of new-device password logins (per org)
Organization settings -> Login security -> Confirm password sign-ins from new devices by email (PUT /v1/orgs/{org}/login-security {"confirm_new_device_logins": true}, admins). When any org of a member has it on, a password login with no 2FA from a device the member never used gets no session: POST /v1/auth/login answers {"confirmation_required": true} and a single-use link (15 minutes) goes to the account's address. Opening /confirm-sign-in?token=... calls POST /v1/auth/login/confirm and starts the session in that browser, which becomes a known device.
Logins with 2FA, passkeys, SSO or a social provider are never held: those already prove more than a password.
Verify: make it runs services/lc-api/tests/login_security_it.rs; cargo test -p lc-api login_security; pnpm --filter web test login-confirm.