Skip to content

feat(admin): mark a WorkOS email verified from the admin - #80

Open
bordoni wants to merge 5 commits into
feat/workos-capabilitiesfrom
feat/mark-email-verified
Open

bordoni wants to merge 5 commits into
feat/workos-capabilitiesfrom
feat/mark-email-verified

Conversation

@bordoni

@bordoni bordoni commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

When a customer's sign-in code doesn't arrive, often because of a filter or a slow mailbox, support has no supported way to mark the WorkOS email verified, even after confirming who the person is another way.

Stacked on #77 (feat/workos-capabilities).

Changes

  • New POST /wp-json/workos/v1/admin/users/{id}/verify-email, where {id} is the WP user ID, like the password-reset route. It looks up the linked WorkOS user, returns already_verified: true without an update when the email is already verified, and otherwise calls update_user with email_verified: true.
  • Gated by a new workos_verify_email capability that maps to edit_users, so nobody can verify their own email by default. None of the Plugin capabilities for WorkOS user management #65 capabilities fit: workos_change_email maps to edit_user, which every user has on their own account.
  • Logs email.admin_verified with the WorkOS email and initiator_id, and clears the user-edit panel's cached WorkOS user.
  • 404 for an unknown user, 409 when the user isn't linked, and 502 workos_api_error when WorkOS fails, so a WorkOS 401 isn't read as the caller's own.
  • WorkOS Users screen: a "Mark email verified" button on rows whose email isn't verified, when the caller can use it (can_verify_email on each row). It asks for confirmation and marks the row verified in place. Rows with no linked WP user don't get it.
  • User-edit WorkOS panel: the same button next to an unverified email. It reuses the shared admin script and confirm modal already on that screen.
  • docs/capabilities.md, README and AGENTS.md updated.

Verified

  • New AdminUsersVerifyEmailTest: logged out, an editor and a user acting on themselves get 403 with no WorkOS call. A role granted workos_verify_email succeeds. Unknown user is 404, unlinked is 409. Already verified is a no-op with no update and no log row. Success sends {"email_verified": true}, logs the initiator and clears the cache. WorkOS errors on the lookup or the update return 502 with no log row. The panel button shows only for an unverified email and only with the capability.
  • The CapabilitiesTest matrix covers workos_verify_email (admins only, same as edit_users), and AdminUsersRestApiTest checks can_verify_email.
  • wpunit: 802 tests plus the 15 in the constants group pass. phpcs, phpstan, bun run build and tsc --noEmit pass.
  • Not yet checked in a browser.

Screenshots

verify-profile-after-desktop verify-profile-after-mobile verify-profile-before-desktop verify-profile-before-mobile verify-users-after-desktop verify-users-after-mobile verify-users-before-desktop verify-users-before-mobile verify-users-modal-desktop verify-users-modal-mobile

Closes #66

Add POST /workos/v1/admin/users/{id}/verify-email for support cases
where the sign-in code never arrives. It looks up the linked WorkOS
user, does nothing when the email is already verified, and otherwise
calls update_user with email_verified true, clears the user-edit panel
cache and logs email.admin_verified with the initiator. WorkOS failures
come back as 502 workos_api_error.

Gated by a new workos_verify_email capability that maps to edit_users,
so it is never self-service by default. The WorkOS Users rows carry
can_verify_email, and the user-edit WorkOS panel shows a Mark email
verified button next to an unverified email.
The WorkOS Users screen gets a per-row button for unverified emails the
caller can verify; it confirms, posts, and marks the row verified in
place. The user-edit panel button is handled by the shared admin
script already loaded there, with the same confirm modal and notice.
@bordoni bordoni added this to the 1.0.11 milestone Oct 17, 2026
@bordoni bordoni added enhancement New feature or request area: admin WP-admin settings & screens labels Oct 17, 2026
@bordoni
bordoni added this pull request to stack #84 October 17, 2026 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: admin WP-admin settings & screens enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant