Skip to content

Commit 6d70339

Browse files
authored
Merge pull request #869 from masteradhoc/868-privacy-policy-content
2 parents 54ec54d + 64606c9 commit 6d70339

1 file changed

Lines changed: 44 additions & 2 deletions

File tree

‎class-two-factor-core.php‎

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ public static function add_hooks( $compat ) {
145145

146146
add_action( 'login_enqueue_scripts', array( __CLASS__, 'login_enqueue_scripts' ), 5 );
147147
add_action( 'admin_init', array( __CLASS__, 'trigger_user_settings_action' ) );
148+
add_action( 'admin_init', array( __CLASS__, 'add_privacy_policy_content' ) );
148149
add_filter( 'two_factor_providers', array( __CLASS__, 'enable_dummy_method_for_debug' ) );
149150

150151
// Add Settings link to plugin action links.
@@ -434,7 +435,7 @@ private static function add_error( WP_Error $error ) {
434435
/**
435436
* Attach Two-Factor profile errors to WordPress core profile update errors.
436437
*
437-
* @since NEXT
438+
* @since 0.16.0
438439
*
439440
* @param WP_Error $errors WP_Error object passed by core.
440441
*
@@ -2664,5 +2665,46 @@ public static function filter_session_information( $session, $user_id ) {
26642665

26652666
return $session;
26662667
}
2667-
}
26682668

2669+
/**
2670+
* Adds suggested privacy policy text for the plugin.
2671+
*
2672+
* @since 0.17.0
2673+
*/
2674+
public static function add_privacy_policy_content() {
2675+
if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
2676+
return;
2677+
}
2678+
2679+
$content =
2680+
'<p class="privacy-policy-tutorial">'
2681+
. __( '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' )
2682+
. '</p>'
2683+
2684+
. '<h3>' . __( 'Two-factor authentication data', 'two-factor' ) . '</h3>'
2685+
. '<p>'
2686+
. __( 'To protect your account we store the following personal data:', 'two-factor' )
2687+
. '</p>'
2688+
. '<ul>'
2689+
. '<li>' . __( '<strong>TOTP secret key</strong> – a unique cryptographic secret generated when you set up an authenticator app. It is stored in your user profile.', 'two-factor' ) . '</li>'
2690+
. '<li>' . __( '<strong>Backup codes</strong> – a set of one-time-use codes you can store offline. Hashed copies are kept in your user profile until they are used or regenerated.', 'two-factor' ) . '</li>'
2691+
. '<li>' . __( '<strong>Email provider verification data</strong> – when the email provider is enabled, the plugin uses the email address already stored in your WordPress account to send a one-time login code. To validate the code, a hashed token and a timestamp are stored temporarily in your user profile metadata. The code itself is not stored.', 'two-factor' ) . '</li>'
2692+
. '<li>' . __( '<strong>Enabled providers list</strong> – a record of which two-factor methods you have activated (e.g. TOTP, email, backup codes) is stored in your user profile.', 'two-factor' ) . '</li>'
2693+
. '</ul>'
2694+
2695+
. '<h3>' . __( 'Who we share your data with', 'two-factor' ) . '</h3>'
2696+
. '<p>'
2697+
. __( 'Two-factor authentication data is never shared with or transmitted to any third party. All data remains on this website.', 'two-factor' )
2698+
. '</p>'
2699+
2700+
. '<h3>' . __( 'How long we retain your data', 'two-factor' ) . '</h3>'
2701+
. '<p>'
2702+
. __( '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' )
2703+
. '</p>';
2704+
2705+
wp_add_privacy_policy_content(
2706+
'Two Factor',
2707+
wp_kses_post( wpautop( $content, false ) )
2708+
);
2709+
}
2710+
}

0 commit comments

Comments
 (0)