<!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>[10029] sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login: Login: Allow users to resend the signup confirmation email.</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/10029">10029</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/10029","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>2020-07-07 08:02:03 +0000 (Tue, 07 Jul 2020)</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: Allow users to resend the signup confirmation email.

To trigger this, either the user needs to click the resend link on the post-signup profile-info page, or attempt to sign up again using the same username or email.

The emails are rate limited depending on  the age of the account, and also based on some WordPress.org anti-spam measures.

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

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgloginadminuiphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/admin/ui.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgloginfunctionsregistrationphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions-registration.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgloginfunctionsrestapiphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions-restapi.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgloginjsregistrationjs">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/js/registration.js</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgloginpendingprofilephp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/pending-profile.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgloginadminuiphp"></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/themes/pub/wporg-login/admin/ui.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/admin/ui.php      2020-07-07 06:54:11 UTC (rev 10028)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/admin/ui.php        2020-07-07 08:02:03 UTC (rev 10029)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -54,7 +54,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        check_admin_referer( 'resend_' . $email );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        if ( $email ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                wporg_send_confirmation_email( $email );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         wporg_login_send_confirmation_email( $email );
</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">        wp_safe_redirect( add_query_arg(
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgloginfunctionsregistrationphp"></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/themes/pub/wporg-login/functions-registration.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/functions-registration.php        2020-07-07 06:54:11 UTC (rev 10028)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions-registration.php  2020-07-07 08:02:03 UTC (rev 10029)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -91,7 +91,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                wp_die( __( 'Error! Something went wrong with your registration. Try again?', 'wporg' ) );
</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">-        wporg_send_confirmation_email( $user_email );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wporg_login_send_confirmation_email( $user_email );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        $url = home_url( sprintf(
</span><span class="cx" style="display: block; padding: 0 10px">                '/register/create-profile/%s/%s/',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -106,10 +106,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Send a "Welcome to WordPress.org" confirmation email.
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function wporg_send_confirmation_email( $user_email ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wporg_login_send_confirmation_email( $user ) {
</ins><span class="cx" style="display: block; padding: 0 10px">         global $wpdb;
</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 = wporg_get_pending_user( $user_email );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $user = wporg_get_pending_user( $user );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        if ( ! $user || $user['created'] ) {
</span><span class="cx" style="display: block; padding: 0 10px">                return false;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -116,6 +116,7 @@
</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">        $user_login = $user['user_login'];
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        $user_email = $user['user_email'];
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        $activation_key = wp_hash( $user_login . ':' . $user_email, 'activation' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -150,6 +151,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function wporg_get_pending_user( $login_or_email ) {
</span><span class="cx" style="display: block; padding: 0 10px">        global $wpdb;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        // Is it a pending user object already?
+       if ( is_array( $login_or_email ) && isset( $login_or_email['pending_id'] ) ) {
+               return $login_or_email;
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         $pending_user = $wpdb->get_row( $wpdb->prepare(
</span><span class="cx" style="display: block; padding: 0 10px">                "SELECT * FROM `{$wpdb->base_prefix}user_pending_registrations` WHERE ( `user_login` = %s OR `user_email` = %s ) LIMIT 1",
</span><span class="cx" style="display: block; padding: 0 10px">                $login_or_email,
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgloginfunctionsrestapiphp"></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/themes/pub/wporg-login/functions-restapi.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/functions-restapi.php     2020-07-07 06:54:11 UTC (rev 10028)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions-restapi.php       2020-07-07 08:02:03 UTC (rev 10029)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,6 +18,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                'methods'  => WP_REST_Server::READABLE,
</span><span class="cx" style="display: block; padding: 0 10px">                'callback' => 'wporg_login_rest_email_in_use'
</span><span class="cx" style="display: block; padding: 0 10px">        ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       register_rest_route( 'wporg/v1', '/resend-confirmation-email/?', array(
+               'methods'  => WP_REST_Server::EDITABLE,
+               'callback' => 'wporg_login_rest_resend_confirmation_email'
+       ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'rest_api_init', 'wporg_login_rest_routes' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -30,7 +35,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">        if ( ($user = get_user_by( 'login', $login )) || ($user = get_user_by( 'slug', $login )) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                return [
</span><span class="cx" style="display: block; padding: 0 10px">                        'available' => false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'error' => __( 'That username is already in use.', 'wporg' ) . '<br>' . __( 'Is it yours? <a href="/lostpassword">Reset your password</a>.', 'wporg' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'error' => __( 'That username is already in use.', 'wporg' ) . '<br>' .
+                               __( 'Is it yours? <a href="/lostpassword">Reset your password</a>.', 'wporg' ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         'avatar' => get_avatar( $user, 64 ),
</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">@@ -39,7 +45,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">        if ( $pending = wporg_get_pending_user( $login ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                return [
</span><span class="cx" style="display: block; padding: 0 10px">                        'available' => false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'error' => __( 'That username is already in use.', 'wporg' ) . '<br>' . __( 'The registration is still pending, please check your email for the confirmation link.', 'wporg' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'error' => __( 'That username is already in use.', 'wporg' ) . '<br>' .
+                               __( 'The registration is still pending, please check your email for the confirmation link.', 'wporg' ) . '<br>' .
+                               '<a href="#" class="resend">' . __( 'Resend confirmation email.', 'wporg' ) . '</a>',
</ins><span class="cx" style="display: block; padding: 0 10px">                         'avatar' => get_avatar( $pending->user_email, 64 ),
</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,7 +72,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">        if ( $user = get_user_by( 'email', $email ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                return [
</span><span class="cx" style="display: block; padding: 0 10px">                        'available' => false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'error' => __( 'That email address already has an account.', 'wporg' ) . '<br>' . __( 'Is it yours? <a href="/lostpassword">Reset your password</a>.', 'wporg' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'error' => __( 'That email address already has an account.', 'wporg' ) . '<br>' .
+                               __( 'Is it yours? <a href="/lostpassword">Reset your password</a>.', 'wporg' ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         'avatar' => get_avatar( $user, 64 ),
</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">@@ -73,7 +82,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">        if ( $pending = wporg_get_pending_user( $email ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                return [
</span><span class="cx" style="display: block; padding: 0 10px">                        'available' => false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'error' => __( 'That email address already has an account.', 'wporg' ) . '<br>' . __( 'The registration is still pending, please check your email for the confirmation link.', 'wporg' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'error' => __( 'That email address already has an account.', 'wporg' ) . '<br>' .
+                               __( 'The registration is still pending, please check your email for the confirmation link.', 'wporg' ) . '<br>' .
+                               '<a href="#" class="resend">' . __( 'Resend confirmation email.', 'wporg' ) . '</a>',
</ins><span class="cx" style="display: block; padding: 0 10px">                         'avatar' => get_avatar( $email, 64 ),
</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">@@ -89,4 +100,51 @@
</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">        return [ 'available' => true ];
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}
+
+/*
+ * Resend a confirmation email to create an account.
+ * 
+ * This API intentionally doesn't report if it performs the action, always returning the success message.
+ */
+function wporg_login_rest_resend_confirmation_email( $request ) {
+       $account = $request['account'];
+
+       $success_message = sprintf(
+               __( 'Please check your email %s for a confirmation link to set your password.', 'wporg' ),
+               '<code>' . esc_html( $account ) . '</code>'
+       );
+
+       $pending_user = wporg_get_pending_user( $request['account'] );
+       if ( ! $pending_user || $pending_user['created'] ) {
+               return $success_message;
+       }
+
+       // Allow for w.org plugins to block the action.
+       if ( null !== ( $pre_register_error = apply_filters( 'wporg_login_pre_registration', null, $pending_user['user_login'], $pending_user['user_email'], $pending_user['meta']['user_mailinglist'] ) ) ) {
+               return $success_message;
+       }
+
+       // Only one email per..
+       // - 1 minute for brand new accounts (<15min)
+       // - 5 minutes for new accounts (<1hr)
+       // - 3 hours there after
+       list( $requested_time, ) = explode( ':', $pending_user['user_activation_key'] );
+       $time_limit = 3 * HOUR_IN_SECONDS;
+
+       if ( time() - strtotime( $pending_user['user_registered'] ) < HOUR_IN_SECONDS ) {
+               $time_limit = 5 * MINUTE_IN_SECONDS;
+       }
+
+       if ( time() - strtotime( $pending_user['user_registered'] ) < 15 * MINUTE_IN_SECONDS ) {
+               $time_limit = MINUTE_IN_SECONDS;
+       }
+
+       if ( ( time() - $requested_time ) < $time_limit ) {
+               return $success_message;
+       }
+
+       wporg_login_send_confirmation_email( $pending_user );
+
+       return $success_message;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgloginjsregistrationjs"></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/themes/pub/wporg-login/js/registration.js</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/js/registration.js        2020-07-07 06:54:11 UTC (rev 10028)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/js/registration.js  2020-07-07 08:02:03 UTC (rev 10029)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -19,17 +19,18 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $this.val();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $.get( rest_url, function( datas ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $this.parents( 'p' ).nextUntil( 'p', 'div.message.error' ).remove();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 $this.closest( 'p' ).nextUntil( 'p', 'div.message' ).remove();
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $this.removeClass( 'good' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                        if ( ! datas.available ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                                $this.addClass( 'error' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                $this.parents( 'p' ).after(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         $this.closest( 'p' ).after(
</ins><span class="cx" style="display: block; padding: 0 10px">                                                         '<div class="message error' + ( datas.avatar ? ' with-avatar' : '' ) +  '"><p>' +
</span><span class="cx" style="display: block; padding: 0 10px">                                                        ( datas.avatar ? datas.avatar : '' ) + '<span>' +
</span><span class="cx" style="display: block; padding: 0 10px">                                                        datas.error +
</span><span class="cx" style="display: block; padding: 0 10px">                                                        '</span></p></div>'
</span><span class="cx" style="display: block; padding: 0 10px">                                                );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                $this.closest( 'p' ).next('div.message.error').find( '.resend' ).data( 'account', $this.val() );
</ins><span class="cx" style="display: block; padding: 0 10px">                                         } else {
</span><span class="cx" style="display: block; padding: 0 10px">                                                $this.addClass( 'good' );
</span><span class="cx" style="display: block; padding: 0 10px">                                        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -36,6 +37,28 @@
</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">+                        $loginForm.on( 'click', '.resend', function( e ) {
+                               var $this = $(this),
+                                       account = $this.data('account');
+
+                               e.preventDefault();
+
+                               $this.closest( 'div.message' ).next('div.message.info').remove();
+
+                               $.post(
+                                       wporg_registration.rest_url + '/resend-confirmation-email',
+                                       {
+                                               account: account,
+                                       },
+                                       function( datas ) {
+                                               $this.closest( 'div.message' ).after(
+                                                       '<div class="message info"><p><span>' + datas + '</span></p></div>'
+                                               );
+                                       }
+                               );
+
+                       });
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         // If the form has data in it upon load, immediately trigger the validation.
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( $loginForm.find('#user_login').val() ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                $loginForm.find('#user_login').blur();
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgloginpendingprofilephp"></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/themes/pub/wporg-login/pending-profile.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/pending-profile.php       2020-07-07 06:54:11 UTC (rev 10028)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/pending-profile.php 2020-07-07 08:02:03 UTC (rev 10029)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -49,21 +49,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> get_header();
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<div class="message info">
-       <p><?php
-               printf(
-                       /* translators: %s Email address */
-                       __( 'Please check your email %s for a confirmation link to set your password.', 'wporg' ),
-                       '<code>' . esc_html( $pending_user['user_email'] ) . '</code>'
-               );
-       ?></p>
-</div>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<form name="registerform" id="registerform" action="" method="post">
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<p class="intro">
-<?php _e( 'Complete your WordPress.org Profile information.', 'wporg' ); ?>
-</p>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <div class="message info">
+               <p><?php
+                       printf(
+                               /* translators: %s Email address */
+                               __( 'Please check your email %s for a confirmation link to set your password.', 'wporg' ) . '<br>' .
+                               '<a href="#" class="resend" data-account="%s">' . __( 'Resend confirmation email.', 'wporg' ) . '</a>',
+                               '<code>' . esc_html( $pending_user['user_email'] ) . '</code>',
+                               esc_attr( $pending_user['user_email'] )
+                       );
+               ?></p>
+       </div>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<form name="registerform" id="registerform" action="" method="post">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <p class="intro">
+       <?php _e( 'Complete your WordPress.org Profile information.', 'wporg' ); ?>
+       </p>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        <p class="login-login">
</span><span class="cx" style="display: block; padding: 0 10px">                <label for="user_login"><?php _e( 'Username', 'wporg' ); ?></label>
</span></span></pre>
</div>
</div>

</body>
</html>