diff --git a/class-two-factor-core.php b/class-two-factor-core.php index d98cbfe6..8ce0fb69 100644 --- a/class-two-factor-core.php +++ b/class-two-factor-core.php @@ -136,6 +136,7 @@ public static function add_hooks( $compat ) { add_action( 'login_enqueue_scripts', array( __CLASS__, 'login_enqueue_scripts' ), 5 ); add_action( 'admin_init', array( __CLASS__, 'trigger_user_settings_action' ) ); + add_action( 'admin_init', array( __CLASS__, 'add_privacy_policy_content' ) ); add_filter( 'two_factor_providers', array( __CLASS__, 'enable_dummy_method_for_debug' ) ); // Add Settings link to plugin action links. @@ -424,7 +425,7 @@ private static function add_error( WP_Error $error ) { /** * Attach Two-Factor profile errors to WordPress core profile update errors. * - * @since NEXT + * @since 0.16.0 * * @param WP_Error $errors WP_Error object passed by core. * @@ -2596,5 +2597,46 @@ public static function filter_session_information( $session, $user_id ) { return $session; } -} + /** + * Adds suggested privacy policy text for the plugin. + * + * @since 0.17.0 + */ + public static function add_privacy_policy_content() { + if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) { + return; + } + + $content = + '

' + . __( 'The Two Factor plugin stores authentication data for your account on this website to verify your identity at login. No data is transmitted to third parties. The suggested text below covers what is stored, why, and for how long.', 'two-factor' ) + . '

' + + . '

' . __( 'Two-factor authentication data', 'two-factor' ) . '

' + . '

' + . __( 'To protect your account we store the following personal data:', 'two-factor' ) + . '

' + . '' + + . '

' . __( 'Who we share your data with', 'two-factor' ) . '

' + . '

' + . __( 'Two-factor authentication data is never shared with or transmitted to any third party. All data remains on this website.', 'two-factor' ) + . '

' + + . '

' . __( 'How long we retain your data', 'two-factor' ) . '

' + . '

' + . __( 'Authentication data (secret keys, backup codes, provider settings) is retained for as long as your user account exists. It is deleted automatically when your account is removed.', 'two-factor' ) + . '

'; + + wp_add_privacy_policy_content( + 'Two Factor', + wp_kses_post( wpautop( $content, false ) ) + ); + } +}