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

@@ -32,6 +32,8 @@ if (($_GET['canned_date'] ?? '') === 'custom' && empty($_GET['dtf'])) {
}
$roles = userRoles();
// Who has passkeys - resetting two-step sign-in takes them away too (functions/passkey.php)
$passkey_counts = passkeyCounts();
$role_filter = isset($roles[intval($_GET['role'] ?? 0)]) ? intval($_GET['role']) : 0;
// The search is for the side being looked at - agents and their invites, or portal users - and leaves the other side's counts alone
@@ -435,6 +437,7 @@ $csrf = $_SESSION['csrf_token'];
$is_on = $off_why === '';
$is_local = $row['user_auth_method'] === 'local';
$has_mfa = trim((string) $row['user_token']) !== '';
$has_passkeys = !empty($passkey_counts[$user_id]);
$can_turn_on = !$is_on && empty($row['client_archived_at']) && empty($row['contact_archived_at']);
$name = escapeHtml($row['contact_name']);
$contact_url = "/agent/contact.php?client_id=$client_id&contact_id=$contact_id";
@@ -515,9 +518,9 @@ $csrf = $_SESSION['csrf_token'];
</a>
<?php } ?>
<?php } ?>
<?php if ($has_mfa) { ?>
<?php if ($has_mfa || $has_passkeys) { ?>
<a class="dropdown-item confirm-link" href="post.php?portal_user_reset_mfa=<?= $user_id ?>&csrf_token=<?= $csrf ?>"
data-confirm-text="<?= $name ?> signs in with their password alone until they set two-step sign-in up again, and is emailed that it was turned off. For a lost or replaced phone."
data-confirm-text="<?= $name ?> signs in with their password alone until they set two-step sign-in up again<?= $has_passkeys ? ', and their passkeys are removed' : '' ?>, and is emailed that it was turned off. For a lost or replaced phone."
data-confirm-button="Turn off two-step">
<i class="fas fa-fw fa-mobile-alt text-secondary me-2"></i>Turn Off Two-step Sign-in
</a>
@@ -694,6 +697,7 @@ $csrf = $_SESSION['csrf_token'];
$is_active = intval($row['user_status']) === 1 && !$is_archived;
$is_admin = intval($row['role_is_admin']) === 1;
$has_mfa = trim((string) $row['user_token']) !== '';
$has_passkeys = !empty($passkey_counts[$user_id]);
$display_name = $is_archived ? trim(str_replace(' (archived)', '', $row['user_name'])) : $row['user_name'];
$name = escapeHtml($display_name);
$quick_url = "modals/user/user.php?id=$user_id";
@@ -788,9 +792,9 @@ $csrf = $_SESSION['csrf_token'];
<a class="dropdown-item ajax-modal" href="#" data-modal-size="lg" data-modal-url="modals/user/user_edit.php?id=<?= $user_id ?>">
<i class="fas fa-fw fa-user-edit text-secondary me-2"></i>Edit
</a>
<?php if ($has_mfa) { ?>
<?php if ($has_mfa || $has_passkeys) { ?>
<a class="dropdown-item confirm-link" href="post.php?reset_user_mfa=<?= $user_id ?>&csrf_token=<?= $csrf ?>"
data-confirm-text="<?= $name ?> signs in with their password alone<?= intval($row['user_config_force_mfa']) ? ' until they set MFA up again, which they are asked to at their next sign in' : ' until they turn MFA on again' ?>. For a lost or replaced phone."
data-confirm-text="<?= $name ?> signs in with their password alone<?= intval($row['user_config_force_mfa']) ? ' until they set MFA up again, which they are asked to at their next sign in' : ' until they turn MFA on again' ?><?= $has_passkeys ? ' - their passkeys are removed too' : '' ?>. For a lost or replaced phone."
data-confirm-button="Reset MFA">
<i class="fas fa-fw fa-mobile-alt text-secondary me-2"></i>Reset MFA
</a>