feat(auth): merge the 2FA trust-device control into sign-in remember-me (BUNYIP-382) #376
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/BUNYIP-382-merge-2fa-remember"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Unifies the two "remember"-style controls into one. The sign-in "Remember me" checkbox now drives both:
The separate 2FA "Trust this device for 30 days" checkbox is removed.
Stacked on #375 (BUNYIP-381) - it uses
refresh_absolute_ttl(remember)+ the remember threading from that PR. Base is the BUNYIP-381 branch; retarget tomainafter #375 merges.Also fixes the BUNYIP-381 lifetime gap
A login deferred for a second factor or the suspicious-login approval gate previously lost
remember(it was not carried in the challenge), so those sessions were always 1 day.rememberis now a claim on the challenge JWT (TwoFactorChallengeClaims,#[serde(default)]for backward compatibility), set from the sign-in choice when the challenge is minted and read at completion.Changes
jwt:create_2fa_challenge_token/create_login_approval_challenge_tokentakeremember; the claim carries it.complete_2fa_login: drops thetrust_deviceparam;claims.rememberdrives both the trusted-device creation (subscribers only; admins still always complete 2FA, BUNYIP-138) and the 30-day/1-day session.complete_login_approval:claims.rememberdrives the session length.loginthreads itsrememberinto both challenge types; magic-link paths passfalse.Verify2FARequestlosestrust_device; handler no longer sends it.TwoFactorForm.trust_device+ the API client'strust_deviceare removed.Behaviour matrix
Testing
just check-containergreen (fmt + clippy-D warnings+cargo test --workspace --all-targets: 275 domain / 73 api / 104 web, 0 failed).