<!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>[10889] sites/trunk: Login: Add an interstitial to record ToS/CoC/Privacy policy acceptance upon login, blocking login if not accepted.</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 { white-space: pre-line; 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/10889">10889</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/10889","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>2021-04-13 07:23:31 +0000 (Tue, 13 Apr 2021)</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'>Login: Add an interstitial to record ToS/CoC/Privacy policy acceptance upon login, blocking login if not accepted.

This is currently only enabled for super admins while the feature is debugged/finalised.

See <a href="http://meta.trac.wordpress.org/ticket/5618">#5618</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkcommonincludeswporgssobbpluginphp">sites/trunk/common/includes/wporg-sso/bb-plugin.php</a></li>
<li><a href="#sitestrunkcommonincludeswporgssoclasswporgssophp">sites/trunk/common/includes/wporg-sso/class-wporg-sso.php</a></li>
<li><a href="#sitestrunkcommonincludeswporgssowppluginphp">sites/trunk/common/includes/wporg-sso/wp-plugin.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgloginupdatedtosphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/updated-tos.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkcommonincludeswporgssobbpluginphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/common/includes/wporg-sso/bb-plugin.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/common/includes/wporg-sso/bb-plugin.php       2021-04-12 20:22:14 UTC (rev 10888)
+++ sites/trunk/common/includes/wporg-sso/bb-plugin.php 2021-04-13 07:23:31 UTC (rev 10889)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -61,5 +61,5 @@
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        new BB_WPOrg_SSO();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ BB_WPOrg_SSO::get_instance();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkcommonincludeswporgssoclasswporgssophp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/common/includes/wporg-sso/class-wporg-sso.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/common/includes/wporg-sso/class-wporg-sso.php 2021-04-12 20:22:14 UTC (rev 10888)
+++ sites/trunk/common/includes/wporg-sso/class-wporg-sso.php   2021-04-13 07:23:31 UTC (rev 10889)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -10,6 +10,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                const SUPPORT_EMAIL = 'forum-password-resets@wordpress.org';
</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 LOGIN_TOS_COOKIE  = 'wporg_tos_login';
+               const TOS_USER_META_KEY = 'tos_revision';
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 const VALID_HOSTS = [
</span><span class="cx" style="display: block; padding: 0 10px">                        'wordpress.org',
</span><span class="cx" style="display: block; padding: 0 10px">                        'bbpress.org',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -24,6 +27,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                public $host;
</span><span class="cx" style="display: block; padding: 0 10px">                public $script;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                private static $instance = null;
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Constructor, instantiate common properties
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -38,6 +43,15 @@
</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">+                public static function get_instance() {
+                       if ( is_null( self::$instance ) ) {
+                               $class = get_called_class();
+                               self::$instance = new $class;
+                       }
+
+                       return self::$instance;
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Checks if the requested redirect_to URL is part of the wordpress.org empire, adds it as an redirect host if so.
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -194,6 +208,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                $to = $this->_get_safer_redirect_to();
</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">+                        if ( function_exists( 'apply_filters' ) ) {
+                               $to = apply_filters( 'wp_redirect', $to, $status );
+                       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         header(
</span><span class="cx" style="display: block; padding: 0 10px">                                'Location: ' . $to,
</span><span class="cx" style="display: block; padding: 0 10px">                                true,
</span></span></pre></div>
<a id="sitestrunkcommonincludeswporgssowppluginphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/common/includes/wporg-sso/wp-plugin.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/common/includes/wporg-sso/wp-plugin.php       2021-04-12 20:22:14 UTC (rev 10888)
+++ sites/trunk/common/includes/wporg-sso/wp-plugin.php 2021-04-13 07:23:31 UTC (rev 10889)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -23,9 +23,30 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'lostpassword' => '/lostpassword(/(?P<user>[^/]+))?',
</span><span class="cx" style="display: block; padding: 0 10px">                        'linkexpired'  => '/linkexpired(/(?P<reason>register|lostpassword)/(?P<user>[^/]+))?',
</span><span class="cx" style="display: block; padding: 0 10px">                        'oauth'        => '/oauth',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                       // Only for logged in users, but prior to cookies.
+                       'updated-tos'  => '/updated-policies',
</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><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 * List of additional valid paths on login.wordpress.org for logged in requests.
+                * @var array
+                */
+               public $valid_sso_paths_logged_in = array(
+                       'logout' => '/logout',
+               );
+
+               /**
+                * List of additional valid paths on login.wordpress.org for logged-out requests.
+                * @var array
+                */
+               public $valid_sso_paths_registration = array(
+                       'pending-profile' => '/register/create-profile(/(?P<profile_user>[^/]+)/(?P<profile_key>[^/]+))?',
+                       'pending-create'  => '/register/create(/(?P<confirm_user>[^/]+)/(?P<confirm_key>[^/]+))?',
+                       'register'        => '/register(/(?P<user>[^/]+))?',
+               );
+
+               /**
</ins><span class="cx" style="display: block; padding: 0 10px">                  * Holds the route hit in `valid_sso_paths`
</span><span class="cx" style="display: block; padding: 0 10px">                 * @var bool|string
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -71,6 +92,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        add_filter( 'lostpassword_url', [ $this, 'add_locale' ], 21 );
</span><span class="cx" style="display: block; padding: 0 10px">                                } else {
</span><span class="cx" style="display: block; padding: 0 10px">                                        add_filter( 'login_redirect', [ $this, 'maybe_add_remote_login_bounce_to_post_login_url' ], 10, 3 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                                       // Updated TOS interceptor.
+                                       add_action( 'set_auth_cookie',   [ $this, 'maybe_block_auth_cookies_context_provider' ], 10, 4 );
+                                       add_filter( 'send_auth_cookies', [ $this, 'maybe_block_auth_cookies' ], 100 );
</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 class="lines" style="display: block; padding: 0 10px; color: #888">@@ -84,8 +109,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        remove_filter( 'pre_site_option_registration', array( $this, 'inherit_registration_option' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                        $value = get_network_option( 1, 'registration', 'none' );
</span><span class="cx" style="display: block; padding: 0 10px">                        add_filter( 'pre_site_option_registration', array( $this, 'inherit_registration_option' ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                         return $value;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Checks if the authenticated is "admin" and returns a nicer error message.
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -196,17 +223,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Extend paths which are only available for logged in users.
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( is_user_logged_in() ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $this->valid_sso_paths['logout'] = '/logout';
-                       }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $this->valid_sso_paths = array_merge(
+                                       $this->valid_sso_paths,
+                                       $this->valid_sso_paths_logged_in
+                               );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Extend registration paths only when registration is open.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( 'user' === get_site_option( 'registration', 'none' ) ) {
-                               // New "pending" registration flow.
-                               $this->valid_sso_paths['pending-profile']  = '/register/create-profile(/(?P<profile_user>[^/]+)/(?P<profile_key>[^/]+))?';
-                               $this->valid_sso_paths['pending-create']   = '/register/create(/(?P<confirm_user>[^/]+)/(?P<confirm_key>[^/]+))?';
-
-                               // Primary registration route.
-                               $this->valid_sso_paths['register']         = '/register(/(?P<user>[^/]+))?';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 } elseif ( 'user' === get_site_option( 'registration', 'none' ) ) {
+                               $this->valid_sso_paths = array_merge(
+                                       $this->valid_sso_paths,
+                                       $this->valid_sso_paths_registration
+                               );
</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">                        $redirect_req = $this->_get_safer_redirect_to();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -528,7 +555,82 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        return $hash;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               /**
+                * The `send_auth_cookies` action used for the below function has no user context.
+                * This function provides user context to it via the local static.
+                */
+               public function maybe_block_auth_cookies_context_provider( $auth_cookie = null, $expire = null, $expiration = null, $user_id = null ) {
+                       static $_user_id_remember_me = false;
+                       if ( ! is_null( $auth_cookie ) ) {
+                               $remember_me = ( 0 !== $expire );
+                               $_user_id_remember_me = compact( 'user_id', 'remember_me' );
+                       } else {
+                               // Fetching the data.
+                               return $_user_id_remember_me;
+                       }
+               }
+
+               /**
+                * Hooked to 'send_auth_cookies' to prevent sending of the Authentication cookies and redirect
+                * to the updated policy interstitial if required.
+                *
+                * Note: This action provides no context about the request, which is why the context is being
+                * provided via the 'set_auth_cookie' filter hook above.
+                */
+               public function maybe_block_auth_cookies( $send_cookies ) {
+                       $user_id = $this->maybe_block_auth_cookies_context_provider()['user_id'] ?? false;
+
+                       if (
+                               $user_id &&
+                               ! $this->has_agreed_to_tos( $user_id )
+                       ) {
+                               $send_cookies = false;
+
+                               // Set a cookie so that we can keep the user in a auth'd (but not) state.
+                               $token_cookie = wp_generate_auth_cookie( $user_id, time() + HOUR_IN_SECONDS, 'tos_token' );
+                               $remember_me  = (int) $this->maybe_block_auth_cookies_context_provider()['remember_me'];
+
+                               setcookie( self::LOGIN_TOS_COOKIE, $token_cookie, time() + HOUR_IN_SECONDS, '/', self::SSO_HOST, true, true );
+                               setcookie( self::LOGIN_TOS_COOKIE . '_remember', $remember_me, time() + HOUR_IN_SECONDS, '/', self::SSO_HOST, true, true );
+
+                               // Redirect them to the interstitial.
+                               add_filter( 'login_redirect', [ $this, 'redirect_to_policy_update' ], 1000 );
+                       }
+
+                       return $send_cookies;
+               }
+
+               /**
+                * Redirects the user to the policy update interstitial.
+                */
+               public function redirect_to_policy_update( $redirect ) {
+                       if ( false === strpos( $redirect, home_url( '/updated-policies' ) ) ) {
+                               $redirect = add_query_arg(
+                                       'redirect_to',
+                                       urlencode( $redirect ),
+                                       home_url( '/updated-policies' )
+                               );
+                       }
+
+                       return $redirect;
+               }
+
+               /**
+                * Whether the given user_id has agreed to the current version of the TOS.
+                */
+               protected function has_agreed_to_tos( $user_id ) {
+                       // TEMPORARY: Limit to supes.
+                       if ( ! is_super_admin() ) {
+                               return true;
+                       }
+
+                       $tos_agreed_to = get_user_meta( $user_id, self::TOS_USER_META_KEY, true ) ?: 0;
+
+                       return $tos_agreed_to >= TOS_REVISION;
+               }
+
</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">-        new WP_WPOrg_SSO();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ WP_WPOrg_SSO::get_instance();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgloginupdatedtosphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/updated-tos.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/themes/pub/wporg-login/updated-tos.php                           (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/updated-tos.php     2021-04-13 07:23:31 UTC (rev 10889)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,100 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * The Updated Terms of Service page.
+ *
+ * @package wporg-login
+ */
+
+$sso = WPOrg_SSO::get_instance();
+
+$token_cookie      = $_COOKIE[ $sso::LOGIN_TOS_COOKIE ] ?? false;
+$login_remember_me = $_COOKIE[ $sso::LOGIN_TOS_COOKIE . '_remember' ] ?? false;
+
+$user_id = wp_validate_auth_cookie( $token_cookie, 'tos_token' );
+if (
+       ! $user_id ||
+       ! ( $user = get_user_by( 'id', $user_id ) )
+) {
+       wp_safe_redirect( '/linkexpired' );
+       exit;
+}
+
+// Set user context for this request only, since the cookies aren't yet set.
+wp_set_current_user( $user );
+
+// Record the TOS agreement.
+if (
+       ! empty( $_POST['_tos_nonce'] ) &&
+       wp_verify_nonce( $_POST['_tos_nonce'], 'agree_to_tos' )
+) {
+       // Agreement has been reached.
+
+       update_user_meta( $user->ID, $sso::TOS_USER_META_KEY, TOS_REVISION );
+       wp_set_auth_cookie( $user->ID, $login_remember_me );
+
+       $sso->redirect_all_login_or_signup_to_sso();
+       exit;
+}
+
+get_header();
+?>
+
+<h2 class="center"><?php _eu( 'Updated Policies', 'wporg' ); ?></h2>
+
+<p>&nbsp;</p>
+
+<p><?php
+       printf(
+               __u( 'Welcome back %s, Some of our policies have been updated, please review the items below before continuing.', 'wporg' ),
+               $user->display_name ?: $user->user_login
+       );
+?></p>
+
+<p>&nbsp;</p>
+
+<p>
+       <a href="<?php _eu( 'https://wordpress.org/about/privacy/', 'wporg' ); ?>"><?php _eu( 'Privacy Policy', 'wporg' ); ?></a>
+</p>
+<?php /* ?>
+<p>
+       <a href="<?php _eu( 'https://wordpress.org/about/terms-of-service/', 'wporg' ); ?>"><?php _eu( 'Terms of Service', 'wporg' ); ?></a>
+</p>
+<p>
+       <a href="<?php _eu( 'https://wordpress.org/about/code-of-conduct/', 'wporg' ); ?>"><?php _eu( 'Code of Conduct', 'wporg' ); ?></a>
+</p>
+<?php //*/ ?>
+
+<p>&nbsp;</p>
+
+<form method="POST">
+       <?php wp_nonce_field( 'agree_to_tos', '_tos_nonce', false ); ?>
+       <input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_unslash( $_REQUEST['redirect_to'] ) ); ?>" />
+       <p class="login-submit">
+               <input type="submit" class="button-primary" value="<?php esc_attr_eu( 'I agree', 'wporg' ); ?>">
+       </p>
+</form>
+
+<p class="center">
+       <a href="https://wordpress.org/" style="font-style: italic;"><?php _eu( 'I do not agree', 'wporg' ); ?></a>
+</p>
+
+<p id="nav">
+       <a href="/"><?php _e( '&larr; Back to login', 'wporg' ); ?></a>
+</p>
+
+<?php get_footer(); ?>
+<?php
+
+// Just in case.. this also prevents certain debug plugins outputting in the footer.
+wp_set_current_user( 0 );
+
+// This is just for during development until strings are finalised.
+function _eu( $s ) {
+       echo $s;
+}
+function __u( $s ) {
+       return $s;
+}
+function esc_attr_eu( $s ) {
+       echo esc_attr( __u( $s ) );
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/updated-tos.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span></div>

</body>
</html>