Changeset 49549
- Timestamp:
- 11/09/2020 06:03:57 PM (5 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
-
js/_enqueues/admin/application-passwords.js (modified) (6 diffs)
-
js/_enqueues/admin/auth-app.js (modified) (1 diff)
-
wp-admin/authorize-application.php (modified) (2 diffs)
-
wp-admin/css/forms.css (modified) (2 diffs)
-
wp-admin/includes/class-wp-application-passwords-list-table.php (modified) (2 diffs)
-
wp-admin/user-edit.php (modified) (3 diffs)
-
wp-includes/script-loader.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/admin/application-passwords.js
r49294 r49549 30 30 } 31 31 32 clear Errors();32 clearNotices(); 33 33 $newAppPassButton.prop( 'aria-disabled', true ).addClass( 'disabled' ); 34 34 … … 91 91 uuid = $tr.data( 'uuid' ); 92 92 93 clear Errors();93 clearNotices(); 94 94 $submitButton.prop( 'disabled', true ); 95 95 … … 106 106 $tr.remove(); 107 107 108 wp.a11y.speak( wp.i18n.__( 'Application password revoked.' ));108 addNotice( wp.i18n.__( 'Application password revoked.' ), 'success' ).focus(); 109 109 } 110 110 } ).fail( handleErrorResponse ); … … 120 120 var $submitButton = $( this ); 121 121 122 clear Errors();122 clearNotices(); 123 123 $submitButton.prop( 'disabled', true ); 124 124 … … 134 134 $appPassTwrapper.hide(); 135 135 136 wp.a11y.speak( wp.i18n.__( 'All application passwords revoked.' ));136 addNotice( wp.i18n.__( 'All application passwords revoked.' ), 'success' ).focus(); 137 137 } 138 138 } ).fail( handleErrorResponse ); 139 139 } ); 140 140 141 $ ( document ).on( 'click', '.new-application-password-notice.notice-dismiss', function( e ) {141 $appPassSection.on( 'click', '.notice-dismiss', function( e ) { 142 142 e.preventDefault(); 143 143 var $el = $( this ).parent(); 144 $el.removeAttr( 'role' ); 144 145 $el.fadeTo( 100, 0, function () { 145 146 $el.slideUp( 100, function () { 146 147 $el.remove(); 148 $newAppPassField.focus(); 147 149 } ); 148 150 } ); … … 170 172 } 171 173 172 add Error( errorMessage);174 addNotice( errorMessage, 'error' ); 173 175 } 174 176 175 177 /** 176 * Displays a n errormessage in the Application Passwords section.178 * Displays a message in the Application Passwords section. 177 179 * 178 180 * @since 5.6.0 179 181 * 180 * @param {string} message The error message to display. 182 * @param {string} message The message to display. 183 * @param {string} type The notice type. Either 'success' or 'error'. 184 * @returns {jQuery} The notice element. 181 185 */ 182 function add Error( message ) {186 function addNotice( message, type ) { 183 187 var $notice = $( '<div></div>' ) 184 188 .attr( 'role', 'alert' ) 185 .addClass( 'notice notice-error' ) 186 .append( $( '<p></p>' ).text( message ) ); 189 .attr( 'tabindex', '-1' ) 190 .addClass( 'is-dismissible notice notice-' + type ) 191 .append( $( '<p></p>' ).text( message ) ) 192 .append( 193 $( '<button></button>' ) 194 .attr( 'type', 'button' ) 195 .addClass( 'notice-dismiss' ) 196 .append( $( '<span></span>' ).addClass( 'screen-reader-text' ).text( wp.i18n.__( 'Dismiss this notice.' ) ) ) 197 ); 187 198 188 199 $newAppPassForm.after( $notice ); 200 201 return $notice; 189 202 } 190 203 191 204 /** 192 * Clears errormessages from the Application Passwords section.205 * Clears notice messages from the Application Passwords section. 193 206 * 194 207 * @since 5.6.0 195 208 */ 196 function clear Errors() {209 function clearNotices() { 197 210 $( '.notice', $appPassSection ).remove(); 198 211 } -
trunk/src/js/_enqueues/admin/auth-app.js
r49294 r49549 84 84 } else { 85 85 message = wp.i18n.sprintf( 86 wp.i18n.__( 'Your new password for %1$s is: %2$s.' ),87 '< strong></strong>',88 '< input type="text" class="code" readonly="readonly" value="" />'89 ) ;86 /* translators: %s: Application name */ 87 '<label for="new-application-password-value">' + wp.i18n.__( 'Your new password for %s is:' ) + '</label>', 88 '<strong></strong>' 89 ) + ' <input id="new-application-password-value" type="text" class="code" readonly="readonly" value="" />'; 90 90 $notice = $( '<div></div>' ) 91 91 .attr( 'role', 'alert' ) 92 .attr( 'tabindex', 0)92 .attr( 'tabindex', -1 ) 93 93 .addClass( 'notice notice-success notice-alt' ) 94 .append( $( '<p></p>' ).addClass( 'application-password-display' ).html( message ) ); 94 .append( $( '<p></p>' ).addClass( 'application-password-display' ).html( message ) ) 95 .append( '<p>' + wp.i18n.__( 'Be sure to save this in a safe location. You will not be able to retrieve it.' ) + '</p>' ); 95 96 96 97 // We're using .text() to write the variables to avoid any chance of XSS. -
trunk/src/wp-admin/authorize-application.php
r49294 r49549 172 172 <div class="notice notice-success notice-alt below-h2"> 173 173 <p class="application-password-display"> 174 <?php 175 printf( 176 /* translators: 1: Application name, 2: Generated password. */ 177 __( 'Your new password for %1$s is %2$s.' ), 178 '<strong>' . esc_html( $app_name ) . '</strong>', 179 sprintf( '<input type="text" class="code" readonly="readonly" value="%s" />', esc_attr( WP_Application_Passwords::chunk_password( $new_password ) ) ) 180 ); 181 ?> 182 </p> 174 <label for="new-application-password-value"> 175 <?php 176 printf( 177 /* translators: %s: Application name */ 178 esc_html__( 'Your new password for %s is:' ), 179 '<strong>' . esc_html( $app_name ) . '</strong>' 180 ); 181 ?> 182 </label> 183 <input id="new-application-password-value" type="text" class="code" readonly="readonly" value="<?php esc_attr( WP_Application_Passwords::chunk_password( $new_password ) ); ?>" /> 184 </p> 185 <p><?php _e( 'Be sure to save this in a safe location. You will not be able to retrieve it.' ); ?></p> 183 186 </div> 184 187 … … 205 208 <div class="form-field"> 206 209 <label for="app_name"><?php _e( 'New Application Password Name' ); ?></label> 207 <input type="text" id="app_name" name="app_name" value="<?php echo esc_attr( $app_name ); ?>" placeholder="<?php esc_attr_e( 'WordPress App on My Phone' ); ?>" required aria-required="true"/>210 <input type="text" id="app_name" name="app_name" value="<?php echo esc_attr( $app_name ); ?>" placeholder="<?php esc_attr_e( 'WordPress App on My Phone' ); ?>" required /> 208 211 </div> 209 212 -
trunk/src/wp-admin/css/forms.css
r49309 r49549 865 865 } 866 866 867 .new-application-password-notice.notice {867 #application-passwords-section .notice { 868 868 margin-top: 20px; 869 869 margin-bottom: 0; … … 872 872 .application-password-display input.code { 873 873 width: 19em; 874 } 875 876 .auth-app-card.card { 877 max-width: 768px; 874 878 } 875 879 -
trunk/src/wp-admin/includes/class-wp-application-passwords-list-table.php
r49321 r49549 118 118 array( 119 119 /* translators: %s: the application password's given name. */ 120 ' title' => sprintf( __( 'Revoke "%s"' ), $item['name'] ),120 'aria-label' => sprintf( __( 'Revoke "%s"' ), $item['name'] ), 121 121 ) 122 122 ); … … 235 235 case 'revoke': 236 236 printf( 237 '<input type="submit" class="button delete" value="%1$s" title="%2$s">',237 '<input type="submit" class="button delete" value="%1$s" aria-label="%2$s">', 238 238 esc_attr( __( 'Revoke' ) ), 239 239 /* translators: %s: the application password's given name. */ -
trunk/src/wp-admin/user-edit.php
r49539 r49549 743 743 <div class="form-field"> 744 744 <label for="new_application_password_name"><?php _e( 'New Application Password Name' ); ?></label> 745 <input type="text" size="30" id="new_application_password_name" name="new_application_password_name" placeholder="<?php esc_attr_e( 'WordPress App on My Phone' ); ?>" class="input" />745 <input type="text" size="30" id="new_application_password_name" name="new_application_password_name" placeholder="<?php esc_attr_e( 'WordPress App on My Phone' ); ?>" class="input" aria-required="true" aria-describedby="<?php esc_attr_e( 'Required to create an Application Password, but not to update the user.' ); ?>" /> 746 746 </div> 747 747 … … 757 757 ?> 758 758 759 <?php submit_button( __( 'Add New ' ), 'secondary', 'do_new_application_password' ); ?>759 <?php submit_button( __( 'Add New Application Password' ), 'secondary', 'do_new_application_password' ); ?> 760 760 </div> 761 761 … … 858 858 <?php if ( isset( $application_passwords_list_table ) ) : ?> 859 859 <script type="text/html" id="tmpl-new-application-password"> 860 <div class="notice notice-success is-dismissible new-application-password-notice" role="alert" tabindex=" 0">860 <div class="notice notice-success is-dismissible new-application-password-notice" role="alert" tabindex="-1"> 861 861 <p class="application-password-display"> 862 <?php 863 printf( 864 /* translators: 1: Application name, 2: Generated password. */ 865 esc_html__( 'Your new password for %1$s is: %2$s' ), 866 '<strong>{{ data.name }}</strong>', 867 '<input type="text" class="code" readonly="readonly" value="{{ data.password }}" />' 868 ); 869 ?> 862 <label for="new-application-password-value"> 863 <?php 864 printf( 865 /* translators: %s: Application name */ 866 __( 'Your new password for %s is:' ), 867 '<strong>{{ data.name }}</strong>' 868 ); 869 ?> 870 </label> 871 <input id="new-application-password-value" type="text" class="code" readonly="readonly" value="{{ data.password }}" /> 870 872 </p> 871 <p><?php esc_attr_e( 'Be sure to save this in a safe location. You will not be able to retrieve it.' ); ?></p>873 <p><?php _e( 'Be sure to save this in a safe location. You will not be able to retrieve it.' ); ?></p> 872 874 <button type="button" class="notice-dismiss"> 873 875 <span class="screen-reader-text"><?php _e( 'Dismiss this notice.' ); ?></span> -
trunk/src/wp-includes/script-loader.php
r49165 r49549 1068 1068 $scripts->set_translations( 'password-strength-meter' ); 1069 1069 1070 $scripts->add( 'application-passwords', "/wp-admin/js/application-passwords$suffix.js", array( 'jquery', 'wp-util', 'wp-api-request', 'wp-date', 'wp-i18n', 'wp-hooks' , 'wp-a11y'), false, 1 );1070 $scripts->add( 'application-passwords', "/wp-admin/js/application-passwords$suffix.js", array( 'jquery', 'wp-util', 'wp-api-request', 'wp-date', 'wp-i18n', 'wp-hooks' ), false, 1 ); 1071 1071 $scripts->set_translations( 'application-passwords' ); 1072 1072
Note: See TracChangeset
for help on using the changeset viewer.