WordPress.org

Making WordPress.org


Ignore:
Timestamp:
02/25/2018 11:27:40 AM (2 years ago)
Author:
obenland
Message:

2FA: First pass at adding backup codes.

See #77.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-two-factor/wporg-two-factor.php

    r6737 r6740  
    5656
    5757        <h2 class="entry-title"><?php esc_html_e( 'Two Factor Authentication', 'wporg' ); ?></h2>
    58         <?php Two_Factor_Totp::admin_notices(); ?>
    5958        <fieldset id="two-factor-active" class="bbp-form two-factor" <?php if ( ! $is_active ) { echo 'style="display:none;"'; } ?>>
    6059            <legend><?php esc_html_e( 'Two Factor Authentication', 'wporg' ); ?></legend>
     
    6362            <div><?php esc_html_e( 'Switching to a new device? Follow these steps to avoid losing access to your account.', 'wporg' ); ?></div>
    6463            <div><button type="cancel" class="button button-secondary alignright"><?php esc_html_e( 'Disable Two Factor Authentication', 'wporg' ); ?></button></div>
     64
     65            <div>
     66                <label for=""><?php esc_html_e( 'Backup Codes', 'worg' ); ?></label>
     67                <fieldset class="bbp-form">
     68                    <?php wp_nonce_field( 'two-factor-backup-codes-generate-json-' . $user->ID, '_nonce-backup-codes' ); ?>
     69                    <button type="button" id="generate-backup-codes" class="button button-secondary"><?php esc_html_e( 'Generate New Backup Codes', 'wporg' ); ?></button>
     70                    <div class="two-factor-backup-codes-wrapper" style="display:none;">
     71                        <p class="description"><?php esc_html_e( 'We ask that you print this list of ten unique, one-time-use backup codes and keep the list in a safe place.', 'wporg' ); ?></p>
     72                        <ol class="two-factor-backup-codes-unused-codes"></ol>
     73                        <div><small><?php esc_html_e( 'Without access to the app or a backup code, you will lose access to your account.', 'wporg' ); ?></small></div>
     74                        <div>
     75                            <input type="checkbox" id="print-agreement" name="print-agreement" />
     76                            <label for="print-agreement"><?php esc_html_e( 'I have printed or saved these codes', 'wporg' ); ?></label>
     77                            <span class="button-group">
     78                                <button type="button" class="button button-secondary dashicons-before dashicons-clipboard" id="two-factor-backup-codes-copy-link" title="<?php esc_attr_e( 'Copy Codes', 'wporg' ); ?>"><span class="screen-reader-text"><?php esc_html_e( 'Copy Codes', 'wporg' ); ?></span></button>
     79                                <button type="button" class="button button-secondary dashicons-before dashicons-index-card" id="two-factor-backup-codes-print-link" title="<?php esc_attr_e( 'Print Codes', 'wporg' ); ?>"><span class="screen-reader-text"><?php esc_html_e( 'Print Codes', 'wporg' ); ?></span></button>
     80                                <a href="" class="button button-secondary dashicons-before dashicons-download" id="two-factor-backup-codes-download-link" title="<?php esc_attr_e( 'Download Codes', 'wporg' ); ?>" download="two-factor-backup-codes.txt"><span class="screen-reader-text"><?php esc_html_e( 'Download Codes', 'wporg' ); ?></span></a>
     81                            </span>
     82                            <button type="submit" class="button button-secondary" disabled="disabled"><?php esc_html_e( 'All Finished!', 'wporg' ); ?></button>
     83                        </div>
     84                    </div>
     85                </fieldset>
     86            </div>
    6587        </fieldset>
    6688        <?php
     
    112134
    113135        <style>
    114             #bbpress-forums fieldset.two-factor:not(#two-factor-start) > div {
    115                 margin-left: 20%;
    116                 width: 60% !important;
    117             }
     136            #bbpress-forums #bbp-your-profile input[type="checkbox"] {
     137                width: auto;
     138            }
     139            #bbpress-forums #bbp-your-profile .two-factor [for="print-agreement"] {
     140                float: none;
     141                width: auto;
     142            }
     143
     144            .dashicons-clipboard:before {
     145                transform: rotate( -45deg );
     146            }
     147            .dashicons-index-card:before {
     148                vertical-align: initial;
     149            }
     150            .dashicons-download:before {
     151                vertical-align: text-top;
     152            }
     153
     154            .two-factor-backup-codes-wrapper [type="submit"] {
     155                vertical-align: middle;
     156            }
     157
    118158            #bbpress-forums .two-factor button.button-link {
    119159                color: #4ca6cf;
Note: See TracChangeset for help on using the changeset viewer.