Skip to content

feat(totp): Consistent user experience for TOTP setup#792

Merged
kasparsd merged 8 commits intomasterfrom
791-totp-ux-improvements
Feb 13, 2026
Merged

feat(totp): Consistent user experience for TOTP setup#792
kasparsd merged 8 commits intomasterfrom
791-totp-ux-improvements

Conversation

@kasparsd
Copy link
Collaborator

@kasparsd kasparsd commented Feb 13, 2026

What?

  • Improve the consistency of TOTP setup flow.
  • Update screenshots to match the updated UX.

Why?

Fixes #791.

How?

Testing Instructions

On a fresh WP setup with the plugin active:

  1. Configure Authenticator App (TOTP) for your user profile.
  2. Confirm that TOTP is stored and enabled.

Screenshots or screencast

Profile screenshot mobile

Changelog Entry

Added - New feature.
Changed - Existing functionality.
Deprecated - Soon-to-be removed feature.
Removed - Feature.
Fixed - Bug fix.
Security - Vulnerability.

@github-actions
Copy link

github-actions bot commented Feb 13, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: kasparsd <kasparsd@git.wordpress.org>
Co-authored-by: masteradhoc <masteradhoc@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

<?php
/* translators: 1: server date and time, 2: timezone. */
printf(
esc_html__( 'Your server date and time is %1$s (%2$s). Please verify this is correct to ensure TOTP will work.', 'two-factor' ),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this notice to the footer -- bellow the code input since that is where it could fail due to server time offset.

?>
</p>
<p>
<code><?php echo esc_html( $key ); ?></code>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now in own line for simple copy-paste. I also experimented with adding a "Copy" button next to it but decided to leave it to a follow-up pull request.

</p>
</li>
<li>
<p><?php esc_html_e( 'Enter the code generated by the Authenticator app to complete the setup:', 'two-factor' ); ?></p>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now all part of the third step instead of being outside of the <ol>.

<?php
printf(
/* translators: 1: server date and time */
esc_html__( 'If the code is rejected, check that your web server time is accurate: %1$s. Your device and server times must match.', 'two-factor' ),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworded this from:

Your server date and time is %1$s (%2$s). Please verify this is correct to ensure TOTP will work.

so that:

  • mention when this is relevant (if the code is rejected),
  • explain why it is relevant (device and server time must match).

esc_html__( 'If the code is rejected, check that your web server time is accurate: %1$s. Your device and server times must match.', 'two-factor' ),
sprintf(
'<time class="two-factor-server-datetime-epoch" datetime="%1$s">%2$s (%3$s)</time>',
esc_attr( wp_date( 'c' ) ),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduced datetime for standard timestamp string that can be useful for any dynamic updates in the future. I had it updating via JS every second from the initial timestamp but I realized that nothing was changing because we don't have the seconds in there.

min-height: 205px;
}
</style>

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the JS and CSS was grouped under the inputs for consistency. Eventually we want to move them into external JS and CSS per #562.

@masteradhoc
Copy link
Collaborator

@kasparsd looks good! we'll have to update the screenshots again as soon as we deprecate FIDO with #439 but thats for another release.

@kasparsd kasparsd merged commit ddf09ad into master Feb 13, 2026
57 checks passed
@kasparsd kasparsd deleted the 791-totp-ux-improvements branch February 13, 2026 12:52
@jeffpaul jeffpaul added this to the 0.15.0 milestone Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TOTP user experience improvements

3 participants