Passkeys: agents and client portal contacts can add a passkey with their password and sign in with it instead of their email and password, counting as two-step sign-in; a passkey that supports PRF also opens an agent's credential vault, otherwise credentials stay locked until they type their password once; admins can turn passkeys off in Security settings, and resetting MFA, turning off a contact's two-step sign-in, archiving an agent and the incident password reset remove them; database 4.2.2 adds user_passkeys, users.user_passkey_handle and settings.config_login_passkeys, and lbuchs/WebAuthn 2.2.0 is bundled in libs/webauthn

This commit is contained in:
johnnyq
2026-11-28 23:31:17 -05:00
parent 4a2933cac9
commit d9c1c752bd
50 changed files with 4679 additions and 46 deletions

View File

@@ -94,6 +94,40 @@ try {
<script>window.itflowAi = <?= json_encode($itflow_ai_config) ?>;</script>
<script src="<?= staticFileUrl('/js/app.js') ?>"></script>
<script src="<?= staticFileUrl('/js/picture_field.js') ?>"></script>
<?php
// Signed in with a passkey that couldn't open the credential vault - their password unlocks it (vaultUnlock(), js/credentials.js)
try {
$itflow_vault_locked = function_exists('vaultLocked') && vaultLocked();
} catch (Throwable $e) {
$itflow_vault_locked = false;
}
if ($itflow_vault_locked) { ?>
<div class="modal" id="vaultUnlockModal" tabindex="-1" data-csrf="<?= $_SESSION['csrf_token'] ?>">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-dark">
<h5 class="modal-title"><i class="fas fa-fw fa-lock me-2"></i>Unlock Your Credentials</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form data-vault-unlock-form autocomplete="off">
<div class="modal-body">
<p>You signed in with a passkey that can't open the credential vault, so usernames, passwords and 2FA codes are locked. Type your password to unlock them until you sign out.</p>
<div data-vault-unlock-message></div>
<label class="form-label">Your password <strong class="text-danger">*</strong></label>
<div class="input-group">
<span class="input-group-text"><i class="fas fa-fw fa-lock"></i></span>
<input type="password" class="form-control" name="password" autocomplete="current-password" required>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary fw-bold"><i class="fas fa-unlock me-2"></i>Unlock</button>
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><i class="fas fa-times me-2"></i>Cancel</button>
</div>
</form>
</div>
</div>
</div>
<?php } ?>
<script src="<?= staticFileUrl('/js/credentials.js') ?>"></script>
<script src="<?= staticFileUrl('/js/tag_picker.js') ?>"></script>
<script src="<?= staticFileUrl('/js/link_picker.js') ?>"></script>

View File

@@ -75,8 +75,9 @@ if (!hash_equals($session_stamp_current, (string) ($_SESSION['user_session_stamp
// MFA required on this account and not set up yet: setting it up, or signing out, is all
// this session may do - every other page, modal, AJAX call and POST goes back to the set
// up page. Signing in only sends them there; this is what keeps them there, including when
// an admin requires MFA, or resets it, on an agent who is already signed in.
if ($session_user_config_force_mfa === 1 && trim((string) $session_token) === '' && !requestIsMfaSetup([
// an admin requires MFA, or resets it, on an agent who is already signed in. A passkey sign-in is
// two-step sign-in already (functions/passkey.php), so it is left be.
if ($session_user_config_force_mfa === 1 && trim((string) $session_token) === '' && ($_SESSION['signed_in_with'] ?? '') !== 'passkey' && !requestIsMfaSetup([
'agent/user/mfa_enforcement.php' => [[[], []]],
'agent/user/post.php' => [[[], ['csrf_token', 'enable_mfa', 'verify_code']], [['logout'], []]],
])) {