7.4.33 | Linux x86_64
Server128.199.10.0
Userwww-data (uid:33)
PHP7.4.33 (apache2handler)
Terminal
Upload
Files: /var/www/html/wp-admin/js
View: auth-app.js
/** * @output wp-admin/js/auth-app.js */ /* global authApp */ ( function( $, authApp ) { var $appNameField = $( '#app_name' ), $approveBtn = $( '#approve' ), $rejectBtn = $( '#reject' ), $form = $appNameField.closest( 'form' ), context = { userLogin: authApp.user_login, successUrl: authApp.success, rejectUrl: authApp.reject }; $approveBtn.on( 'click', function( e ) { var name = $appNameField.val(), appId = $( 'input[name="app_id"]', $form ).val(); e.preventDefault(); if ( $approveBtn.prop( 'aria-disabled' ) ) { return; } if ( 0 === name.length ) { $appNameField.trigger( 'focus' ); return; } $approveBtn.prop( 'aria-disabled', true ).addClass( 'disabled' ); var request = { name: name }; if ( appId.length > 0 ) { request.app_id = appId; } /** * Filters the request data used to Authorize an Application Password request. * * @since 5.6.0 * * @param {Object} request The request data. * @param {Object} context Context about the Application Password request. * @param {string} context.userLogin The user's login username. * @param {string} context.successUrl The URL the user will be redirected to after approving the request. * @param {string} context.rejectUrl The URL the user will be redirected to after rejecting the request. */ request = wp.hooks.applyFilters( 'wp_application_passwords_approve_app_request', request, context ); wp.apiRequest( { path: '/wp/v2/users/me/application-passwords?_locale=user', method: 'POST', data: request } ).done( function( response, textStatus, jqXHR ) { /** * Fires when an Authorize Application Password request has been successfully approved. * * In most cases, this should be used in combination with the {@see 'wp_authorize_application_password_form_approved_no_js'} * action to ensure that both the JS and no-JS variants are handled. * * @since 5.6.0 * * @param {Object} response The response from the REST API. * @param {string} response.password The newly created password. * @param {string} textStatus The status of the request. * @param {jqXHR} jqXHR The underlying jqXHR object that made the request. */ wp.hooks.doAction( 'wp_application_passwords_approve_app_request_success', response, textStatus, jqXHR ); var raw = authApp.success, url, message, $notice; if ( raw ) { url = raw + ( -1 === raw.indexOf( '?' ) ? '?' : '&' ) + 'site_url=' + encodeURIComponent( authApp.site_url ) + '&user_login=' + encodeURIComponent( authApp.user_login ) + '&password=' + encodeURIComponent( response.password ); window.location = url; } else { message = wp.i18n.sprintf( /* translators: %s: Application name. */ '<label for="new-application-password-value">' + wp.i18n.__( 'Your new password for %s is:' ) + '</label>', '<strong></strong>' ) + ' <input id="new-application-password-value" type="text" class="code" readonly="readonly" value="" />'; $notice = $( '<div></div>' ) .attr( 'role', 'alert' ) .attr( 'tabindex', -1 ) .addClass( 'notice notice-success notice-alt' ) .append( $( '<p></p>' ).addClass( 'application-password-display' ).html( message ) ) .append( '<p>' + wp.i18n.__( 'Be sure to save this in a safe location. You will not be able to retrieve it.' ) + '</p>' ); // We're using .text() to write the variables to avoid any chance of XSS. $( 'strong', $notice ).text( response.name ); $( 'input', $notice ).val( response.password ); $form.replaceWith( $notice ); $notice.trigger( 'focus' ); } } ).fail( function( jqXHR, textStatus, errorThrown ) { var errorMessage = errorThrown, error = null; if ( jqXHR.responseJSON ) { error = jqXHR.responseJSON; if ( error.message ) { errorMessage = error.message; } } var $notice = $( '<div></div>' ) .attr( 'role', 'alert' ) .addClass( 'notice notice-error' ) .append( $( '<p></p>' ).text( errorMessage ) ); $( 'h1' ).after( $notice ); $approveBtn.removeProp( 'aria-disabled', false ).removeClass( 'disabled' ); /** * Fires when an Authorize Application Password request encountered an error when trying to approve the request. * * @since 5.6.0 * @since 5.6.1 Corrected action name and signature. * * @param {Object|null} error The error from the REST API. May be null if the server did not send proper JSON. * @param {string} textStatus The status of the request. * @param {string} errorThrown The error message associated with the response status code. * @param {jqXHR} jqXHR The underlying jqXHR object that made the request. */ wp.hooks.doAction( 'wp_application_passwords_approve_app_request_error', error, textStatus, errorThrown, jqXHR ); } ); } ); $rejectBtn.on( 'click', function( e ) { e.preventDefault(); /** * Fires when an Authorize Application Password request has been rejected by the user. * * @since 5.6.0 * * @param {Object} context Context about the Application Password request. * @param {string} context.userLogin The user's login username. * @param {string} context.successUrl The URL the user will be redirected to after approving the request. * @param {string} context.rejectUrl The URL the user will be redirected to after rejecting the request. */ wp.hooks.doAction( 'wp_application_passwords_reject_app', context ); // @todo: Make a better way to do this so it feels like less of a semi-open redirect. window.location = authApp.reject; } ); $form.on( 'submit', function( e ) { e.preventDefault(); } ); }( jQuery, authApp ) );
NameSizeActions
accordion.js2.9KView Edit Del
accordion.min.js758BView Edit Del
application-passwords.js6.2KView Edit Del
application-passwords.min.js3KView Edit Del
auth-app.js5.7KView Edit Del
auth-app.min.js2KView Edit Del
code-editor.js17.5KView Edit Del
code-editor.min.js3.5KView Edit Del
color-picker.js9.5KView Edit Del
color-picker.min.js3.4KView Edit Del
comment.js2.9KView Edit Del
comment.min.js1.3KView Edit Del
common.js61.3KView Edit Del
common.min.js23.2KView Edit Del
custom-background.js3.4KView Edit Del
custom-background.min.js1.2KView Edit Del
custom-header.js2KView Edit Del
customize-controls.js288.4KView Edit Del
customize-controls.min.js109.7KView Edit Del
customize-nav-menus.js111.5KView Edit Del
customize-nav-menus.min.js47.1KView Edit Del
customize-widgets.js70KView Edit Del
customize-widgets.min.js27.4KView Edit Del
dashboard.js27KView Edit Del
dashboard.min.js8.7KView Edit Del
edit-comments.js37.2KView Edit Del
edit-comments.min.js15.2KView Edit Del
editor-expand.js41.6KView Edit Del
editor-expand.min.js13.1KView Edit Del
editor.js44KView Edit Del
editor.min.js12.8KView Edit Del
farbtastic.js7.7KView Edit Del
gallery.js5.4KView Edit Del
gallery.min.js3.7KView Edit Del
image-edit.js40KView Edit Del
image-edit.min.js15.2KView Edit Del
inline-edit-post.js20.2KView Edit Del
inline-edit-post.min.js9.4KView Edit Del
inline-edit-tax.js7.6KView Edit Del
inline-edit-tax.min.js2.9KView Edit Del
iris.min.js23.1KView Edit Del
language-chooser.js890BView Edit Del
language-chooser.min.js423BView Edit Del
link.js4.8KView Edit Del
link.min.js2.3KView Edit Del
media-gallery.js1.3KView Edit Del
media-gallery.min.js611BView Edit Del
media-upload.js3.4KView Edit Del
media-upload.min.js1.1KView Edit Del
media.js6.6KView Edit Del
media.min.js2.4KView Edit Del
nav-menu.js61.1KView Edit Del
nav-menu.min.js30.1KView Edit Del
password-strength-meter.js4.1KView Edit Del
password-strength-meter.min.js1.1KView Edit Del
password-toggle.js1.3KView Edit Del
password-toggle.min.js847BView Edit Del
plugin-install.js6.9KView Edit Del
plugin-install.min.js2.3KView Edit Del
post.js39.5KView Edit Del
post.min.js19KView Edit Del
postbox.js18.5KView Edit Del
postbox.min.js6.6KView Edit Del
privacy-tools.js10.7KView Edit Del
privacy-tools.min.js5KView Edit Del
revisions.js33.9KView Edit Del
revisions.min.js18KView Edit Del
set-post-thumbnail.js876BView Edit Del
set-post-thumbnail.min.js620BView Edit Del
site-health.js13.6KView Edit Del
site-health.min.js6.3KView Edit Del
site-icon.js6.1KView Edit Del
site-icon.min.js2.2KView Edit Del
svg-painter.js3.2KView Edit Del
svg-painter.min.js1.5KView Edit Del
tags-box.js10.9KView Edit Del
tags-box.min.js3KView Edit Del
tags-suggest.js5.6KView Edit Del
tags-suggest.min.js2.2KView Edit Del
tags.js6KView Edit Del
tags.min.js2.4KView Edit Del
theme-plugin-editor.js25.6KView Edit Del
theme-plugin-editor.min.js11.8KView Edit Del
theme.js54.9KView Edit Del
theme.min.js26.5KView Edit Del
updates.js109.4KView Edit Del
updates.min.js47.3KView Edit Del
user-profile.js17.9KView Edit Del
user-profile.min.js7.8KView Edit Del
user-suggest.js2.2KView Edit Del
user-suggest.min.js676BView Edit Del
widgets/--
widgets.js22.6KView Edit Del
widgets.min.js12.3KView Edit Del
word-count.js7.5KView Edit Del
word-count.min.js1.5KView Edit Del
xfn.js740BView Edit Del
xfn.min.js458BView Edit Del