Changeset 6740
- Timestamp:
- 02/25/2018 11:27:40 AM (7 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-two-factor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-two-factor/js/profile-edit.js
r6737 r6740 81 81 ); 82 82 } ); 83 84 $( '#generate-backup-codes' ).on( 'click', function() { 85 $.post( 86 ajaxurl, 87 { 88 action: 'two_factor_backup_codes_generate', 89 user_id: $( '#user_id' ).val(), 90 nonce: $( '#_nonce-backup-codes' ).val(), 91 }, 92 function( response ) { 93 if ( response.success ) { 94 var $codesList = $( '.two-factor-backup-codes-unused-codes' ); 95 96 $( '#generate-backup-codes' ).remove(); 97 $( '.two-factor-backup-codes-wrapper' ).show(); 98 $codesList.html( '' ); 99 100 // Append the codes. 101 for ( i = 0; i < response.data.codes.length; i++ ) { 102 $codesList.append( '<li>' + response.data.codes[ i ] + '</li>' ); 103 } 104 105 // Update counter. 106 $( '.two-factor-backup-codes-count' ).html( response.data.i18n.count ); 107 108 // Build the download link 109 var txt_data = 'data:application/text;charset=utf-8,' + '\n'; 110 txt_data += response.data.i18n.title.replace( /%s/g, document.domain ) + '\n\n'; 111 112 for ( i = 0; i < response.data.codes.length; i++ ) { 113 txt_data += i + 1 + '. ' + response.data.codes[ i ] + '\n'; 114 } 115 116 $( '#two-factor-backup-codes-download-link' ).attr( 'href', encodeURI( txt_data ) ); 117 } 118 } 119 ); 120 } ); 121 122 $( '#print-agreement' ).on( 'change', function() { 123 $( '.two-factor-backup-codes-wrapper button[type="submit"]' ).prop( 'disabled', ! $( this ).prop( 'checked' ) ); 124 } ); 125 83 126 } ); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-two-factor/wporg-two-factor.php
r6737 r6740 56 56 57 57 <h2 class="entry-title"><?php esc_html_e( 'Two Factor Authentication', 'wporg' ); ?></h2> 58 <?php Two_Factor_Totp::admin_notices(); ?>59 58 <fieldset id="two-factor-active" class="bbp-form two-factor" <?php if ( ! $is_active ) { echo 'style="display:none;"'; } ?>> 60 59 <legend><?php esc_html_e( 'Two Factor Authentication', 'wporg' ); ?></legend> … … 63 62 <div><?php esc_html_e( 'Switching to a new device? Follow these steps to avoid losing access to your account.', 'wporg' ); ?></div> 64 63 <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> 65 87 </fieldset> 66 88 <?php … … 112 134 113 135 <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 118 158 #bbpress-forums .two-factor button.button-link { 119 159 color: #4ca6cf;
Note: See TracChangeset
for help on using the changeset viewer.