Encourage setting up a second recovery method #642
Merged
Conversation
Collect all warnings into same place
kasparsd
commented
Sep 19, 2024
| sprintf( | ||
| __( 'To update your Two-Factor options, you must first revalidate your session.', 'two-factor' ) . | ||
| '<br><a class="button" href="%s">' . __( 'Revalidate now', 'two-factor' ) . '</a>', | ||
| $notices['warning two-factor-warning-revalidate-session'] = sprintf( |
Collaborator
Author
There was a problem hiding this comment.
I don't like the hidden meaning of the first key string being the class suffix for notice-* but that's how we can allow for multiple notices of the same type without introducing some kind of an abstraction.
| <p><?php echo $notice; ?></p> | ||
| </div> | ||
| <?php endforeach; ?> | ||
| <p> |
Collaborator
Author
There was a problem hiding this comment.
These are now permanent instructions suggest the best-practice setup.
thrijith
reviewed
Sep 26, 2024
class-two-factor-core.php
Outdated
| <h2><?php esc_html_e( 'Two-Factor Options', 'two-factor' ); ?></h2> | ||
| <?php foreach ( $notices as $notice_type => $notice ) : ?> | ||
| <div class="<?php echo esc_attr( $notice_type ? 'notice inline notice-' . $notice_type : '' ); ?>"> | ||
| <p><?php echo $notice; ?></p> |
Contributor
There was a problem hiding this comment.
I see the values are already escaped early should there be a wp_kses here to be safe / should we mention the values are already escaped above?
Collaborator
Author
There was a problem hiding this comment.
This is now done in 2284d6a. We're using wp_kses_post() similar to how WP core does it here:
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Fixes #485.
Why?
Encourage users to configure at least two two-factor methods to prevent them from being locked out of account in case of loosing access to the primary method.
How?
Showing a notice before any of the methods are configured and when only one method is configured.
Testing Instructions
Screenshots or screencast
No methods configured:
Only one method configured:
Multiple notices:
Changelog Entry
Added a notice to the user profile suggesting to configure at least two two-factor methods for ensuring access.