<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[6781] sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-two-factor/wporg-two-factor.php: 2FA: Switch from using a nonced login to defining a `wporg_2fa` cookie instead.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/6781">6781</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/6781","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>dd32</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2018-02-27 02:30:31 +0000 (Tue, 27 Feb 2018)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>2FA: Switch from using a nonced login to defining a `wporg_2fa` cookie instead.
This works by making the WordPress cookies only valid when the 2FA cookie is also set.
This differs from the `two-factoe` plugin which only sets auth cookies after 2FA is completed.
See <a href="http://meta.trac.wordpress.org/ticket/77">#77</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporgtwofactorwporgtwofactorphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-two-factor/wporg-two-factor.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporgtwofactorwporgtwofactorphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-two-factor/wporg-two-factor.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-two-factor/wporg-two-factor.php 2018-02-27 01:56:44 UTC (rev 6780)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-two-factor/wporg-two-factor.php 2018-02-27 02:30:31 UTC (rev 6781)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -12,9 +12,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> class WPORG_Two_Factor extends Two_Factor_Core {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const WPORG_2FA_COOKIE = 'wporg_2fa';
+
</ins><span class="cx" style="display: block; padding: 0 10px"> public function __construct() {
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'two_factor_providers', [ $this, 'two_factor_providers' ] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_filter( 'determine_current_user', [ $this, 'disable_authentication_without_2fa' ], 20 ); // Cookies at priority 10, Must be > 11
+ add_action( 'clear_auth_cookie', [ $this, 'clear_2fa_cookies' ] );
+ add_filter( 'salt', [ $this, 'add_2fa_salt' ], 10, 2 );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> remove_action( 'edit_user_profile', [ 'Two_Factor_Core', 'user_two_factor_options' ] );
</span><span class="cx" style="display: block; padding: 0 10px"> remove_action( 'show_user_profile', [ 'Two_Factor_Core', 'user_two_factor_options' ] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -37,6 +43,79 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function add_2fa_salt( $salt, $scheme ) {
+ if ( '2fa' == $scheme ) {
+ $salt = defined( 'WPORG_2FA_KEY' ) ? WPORG_2FA_KEY : AUTH_KEY;
+ }
+
+ return $salt;
+ }
+
+ function disable_authentication_without_2fa( $user_id ) {
+ if ( ! $user_id ) {
+ return $user_id;
+ }
+ // User is logged in:
+
+ // If the user isn't a 2FA user, allow.
+ if ( ! self::is_user_using_two_factor( $user_id ) ) {
+ return $user_id;
+ }
+
+ // If the user has a valid 2FA cookie, allow
+ if ( isset( $_COOKIE[ self::WPORG_2FA_COOKIE ] ) && wp_validate_auth_cookie( $_COOKIE[ self::WPORG_2FA_COOKIE ], '2fa' ) ) {
+ return $user_id;
+ }
+
+ // If the user did not authenticate via Cookie, allow
+ if ( ! wp_validate_auth_cookie( false ) && ! wp_validate_logged_in_cookie( false ) ) {
+ // The user wasn't authenticated by cookie, so allow the auth.
+ return $user_id;
+ }
+
+ // If they're on the 2FA login page, allow
+ $login_host = class_exists( 'WPOrg_SSO' ) ? WPOrg_SSO::SSO_HOST : 'login.wordpress.org';
+ if ( $login_host === $_SERVER['HTTP_HOST'] ) {
+ if ( '/wp-login.php' == substr( $_SERVER['REQUEST_URI'], 0, 13 ) ) {
+ if ( $_POST || 'backup_2fa' == $_REQUEST['action'] || 'validate_2fa' == $_REQUEST['action'] ) {
+ return $user_id;
+ }
+ }
+ }
+
+ /*
+ * Fail. We've checked that:
+ * - the user has 2FA enabled
+ * - doesn't have a valid 2FA cookie
+ * - the user is logged in via cookie
+ * - isn't currently logging in on the SSO host
+ *
+ * The users cookies are not valid until that 2FA cookie is set.
+ */
+ return 0;
+ }
+
+ function clear_2fa_cookies() {
+ setcookie( self::WPORG_2FA_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN );
+ setcookie( self::WPORG_2FA_COOKIE, ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN );
+ }
+
+ function set_2fa_cookies( $user ) {
+ // Set the Expiration based on the main Authentication cookie
+ $auth_cookie_parts = wp_parse_auth_cookie( '', 'secure_auth' );
+ if ( ! $auth_cookie_parts ) {
+ wp_logout();
+ return;
+ }
+
+ $expiration = $auth_cookie_parts['expiration'];
+
+ $cookie_value = wp_generate_auth_cookie( $user->ID, $expiration, '2fa', '' /* WordPress.org doesn't use Session Tokens yet */ );
+
+ setcookie( self::WPORG_2FA_COOKIE, $cookie_value, $expiration, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, true, true );
+ setcookie( self::WPORG_2FA_COOKIE, $cookie_value, $expiration, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, true, true );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Handle the browser-based login.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -50,11 +129,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_clear_auth_cookie();
-
</del><span class="cx" style="display: block; padding: 0 10px"> wp_enqueue_style( 'two-factor-login', plugins_url( '/css/login.css', __FILE__ ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self::show_two_factor_login( $user );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : $_SERVER['REQUEST_URI'];
+ self::login_html( $user, '', $redirect_to );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> exit;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -64,27 +143,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 0.1-dev
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function login_form_validate_2fa() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! isset( $_POST['wp-auth-id'], $_POST['wp-auth-nonce'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! is_user_logged_in() ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $user = get_userdata( $_POST['wp-auth-id'] );
- if ( ! $user ) {
- return;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $user = wp_get_current_user();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $nonce = $_POST['wp-auth-nonce'];
- if ( true !== self::verify_login_nonce( $user->ID, $nonce ) ) {
- wp_safe_redirect( get_bloginfo( 'url' ) );
- exit;
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $_POST['provider'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $providers = self::get_available_providers_for_user( $user );
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $providers[ $_POST['provider'] ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $provider = $providers[ $_POST['provider'] ];
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_die( esc_html__( 'Cheatin’ uh?' ), 403 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_die( 'A valid 2FA provider could not be found.', 403 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $provider = self::get_primary_provider_for_user( $user->ID );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -92,12 +162,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Allow the provider to re-send codes, etc.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( true === $provider->pre_process_authentication( $user ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $login_nonce = self::create_login_nonce( $user->ID );
- if ( ! $login_nonce ) {
- wp_die( esc_html__( 'Failed to create a login nonce.', 'two-factor' ) );
- }
-
- self::login_html( $user, $login_nonce['key'], $_REQUEST['redirect_to'], '', $provider );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self::login_html( $user, '', $_REQUEST['redirect_to'], '', $provider );
</ins><span class="cx" style="display: block; padding: 0 10px"> exit;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -105,24 +170,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( true !== $provider->validate_authentication( $user ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> do_action( 'wp_login_failed', $user->user_login );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $login_nonce = self::create_login_nonce( $user->ID );
- if ( ! $login_nonce ) {
- wp_die( esc_html__( 'Failed to create a login nonce.', 'two-factor' ) );
- }
-
- self::login_html( $user, $login_nonce['key'], $_REQUEST['redirect_to'], esc_html__( 'ERROR: Invalid verification code.', 'two-factor' ), $provider );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self::login_html( $user, '', $_REQUEST['redirect_to'], esc_html__( 'ERROR: Invalid verification code.', 'wporg' ), $provider );
</ins><span class="cx" style="display: block; padding: 0 10px"> exit;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self::delete_login_nonce( $user->ID );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->set_2fa_cookies( $user );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $rememberme = false;
- if ( isset( $_REQUEST['rememberme'] ) && $_REQUEST['rememberme'] ) {
- $rememberme = true;
- }
-
- wp_set_auth_cookie( $user->ID, $rememberme );
-
</del><span class="cx" style="display: block; padding: 0 10px"> // Must be global because that's how login_header() uses it.
</span><span class="cx" style="display: block; padding: 0 10px"> global $interim_login;
</span><span class="cx" style="display: block; padding: 0 10px"> $interim_login = isset( $_REQUEST['interim-login'] ); // WPCS: override ok.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -159,40 +212,29 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 0.1-dev
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function backup_2fa() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! isset( $_GET['wp-auth-id'], $_GET['wp-auth-nonce'], $_GET['provider'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! is_user_logged_in() ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $user = get_userdata( $_GET['wp-auth-id'] );
- if ( ! $user ) {
- return;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $user = wp_get_current_user();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $nonce = $_GET['wp-auth-nonce'];
- if ( true !== self::verify_login_nonce( $user->ID, $nonce ) ) {
- wp_safe_redirect( get_bloginfo( 'url' ) );
- exit;
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> $providers = self::get_available_providers_for_user( $user );
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $providers[ $_GET['provider'] ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $provider = $providers[ $_GET['provider'] ];
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_die( esc_html__( 'Cheatin’ uh?' ), 403 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_die( 'No 2FA provider could be found.', 403 );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self::login_html( $user, $_GET['wp-auth-nonce'], $_GET['redirect_to'], '', $provider );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self::login_html( $user, '', $_GET['redirect_to'], '', $provider );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> exit;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function two_factor_providers( $providers) {
- $wporg_providers = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function two_factor_providers() {
+ return array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'WPORG_Two_Factor_Primary' => __DIR__ . '/providers/class-wporg-two-factor-primary.php',
</span><span class="cx" style="display: block; padding: 0 10px"> 'WPORG_Two_Factor_Secondary' => __DIR__ . '/providers/class-wporg-two-factor-secondary.php',
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return $wporg_providers;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -200,10 +242,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * NOTE: It's assumed that the Two Factor details have been setup correctly previously.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function enable_two_factor( $user_id ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return (
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $result = (
</ins><span class="cx" style="display: block; padding: 0 10px"> update_user_meta( $user_id, self::PROVIDER_USER_META_KEY, 'WPORG_Two_Factor_Primary' ) &&
</span><span class="cx" style="display: block; padding: 0 10px"> update_user_meta( $user_id, self::ENABLED_PROVIDERS_USER_META_KEY, [ 'WPORG_Two_Factor_Primary', 'WPORG_Two_Factor_Secondary' ] )
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( $result && $user_id == get_current_user_id() ) {
+ $user = wp_get_current_user();
+ $this->set_2fa_cookies( $user );
+ }
+
+ return $result;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre>
</div>
</div>
</body>
</html>