Edit File by line
/home/barbar84/public_h.../wp-admin/js
File: user-profile.js
/**
[0] Fix | Delete
* @output wp-admin/js/user-profile.js
[1] Fix | Delete
*/
[2] Fix | Delete
[3] Fix | Delete
/* global ajaxurl, pwsL10n, userProfileL10n */
[4] Fix | Delete
(function($) {
[5] Fix | Delete
var updateLock = false,
[6] Fix | Delete
__ = wp.i18n.__,
[7] Fix | Delete
$pass1Row,
[8] Fix | Delete
$pass1,
[9] Fix | Delete
$pass2,
[10] Fix | Delete
$weakRow,
[11] Fix | Delete
$weakCheckbox,
[12] Fix | Delete
$toggleButton,
[13] Fix | Delete
$submitButtons,
[14] Fix | Delete
$submitButton,
[15] Fix | Delete
currentPass,
[16] Fix | Delete
$passwordWrapper;
[17] Fix | Delete
[18] Fix | Delete
function generatePassword() {
[19] Fix | Delete
if ( typeof zxcvbn !== 'function' ) {
[20] Fix | Delete
setTimeout( generatePassword, 50 );
[21] Fix | Delete
return;
[22] Fix | Delete
} else if ( ! $pass1.val() || $passwordWrapper.hasClass( 'is-open' ) ) {
[23] Fix | Delete
// zxcvbn loaded before user entered password, or generating new password.
[24] Fix | Delete
$pass1.val( $pass1.data( 'pw' ) );
[25] Fix | Delete
$pass1.trigger( 'pwupdate' );
[26] Fix | Delete
showOrHideWeakPasswordCheckbox();
[27] Fix | Delete
} else {
[28] Fix | Delete
// zxcvbn loaded after the user entered password, check strength.
[29] Fix | Delete
check_pass_strength();
[30] Fix | Delete
showOrHideWeakPasswordCheckbox();
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
// Install screen.
[34] Fix | Delete
if ( 1 !== parseInt( $toggleButton.data( 'start-masked' ), 10 ) ) {
[35] Fix | Delete
// Show the password not masked if admin_password hasn't been posted yet.
[36] Fix | Delete
$pass1.attr( 'type', 'text' );
[37] Fix | Delete
} else {
[38] Fix | Delete
// Otherwise, mask the password.
[39] Fix | Delete
$toggleButton.trigger( 'click' );
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
// Once zxcvbn loads, passwords strength is known.
[43] Fix | Delete
$( '#pw-weak-text-label' ).text( __( 'Confirm use of weak password' ) );
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
function bindPass1() {
[47] Fix | Delete
currentPass = $pass1.val();
[48] Fix | Delete
[49] Fix | Delete
if ( 1 === parseInt( $pass1.data( 'reveal' ), 10 ) ) {
[50] Fix | Delete
generatePassword();
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
$pass1.on( 'input' + ' pwupdate', function () {
[54] Fix | Delete
if ( $pass1.val() === currentPass ) {
[55] Fix | Delete
return;
[56] Fix | Delete
}
[57] Fix | Delete
[58] Fix | Delete
currentPass = $pass1.val();
[59] Fix | Delete
[60] Fix | Delete
// Refresh password strength area.
[61] Fix | Delete
$pass1.removeClass( 'short bad good strong' );
[62] Fix | Delete
showOrHideWeakPasswordCheckbox();
[63] Fix | Delete
} );
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
function resetToggle( show ) {
[67] Fix | Delete
$toggleButton
[68] Fix | Delete
.attr({
[69] Fix | Delete
'aria-label': show ? __( 'Show password' ) : __( 'Hide password' )
[70] Fix | Delete
})
[71] Fix | Delete
.find( '.text' )
[72] Fix | Delete
.text( show ? __( 'Show' ) : __( 'Hide' ) )
[73] Fix | Delete
.end()
[74] Fix | Delete
.find( '.dashicons' )
[75] Fix | Delete
.removeClass( show ? 'dashicons-hidden' : 'dashicons-visibility' )
[76] Fix | Delete
.addClass( show ? 'dashicons-visibility' : 'dashicons-hidden' );
[77] Fix | Delete
}
[78] Fix | Delete
[79] Fix | Delete
function bindToggleButton() {
[80] Fix | Delete
$toggleButton = $pass1Row.find('.wp-hide-pw');
[81] Fix | Delete
$toggleButton.show().on( 'click', function () {
[82] Fix | Delete
if ( 'password' === $pass1.attr( 'type' ) ) {
[83] Fix | Delete
$pass1.attr( 'type', 'text' );
[84] Fix | Delete
resetToggle( false );
[85] Fix | Delete
} else {
[86] Fix | Delete
$pass1.attr( 'type', 'password' );
[87] Fix | Delete
resetToggle( true );
[88] Fix | Delete
}
[89] Fix | Delete
});
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
/**
[93] Fix | Delete
* Handle the password reset button. Sets up an ajax callback to trigger sending
[94] Fix | Delete
* a password reset email.
[95] Fix | Delete
*/
[96] Fix | Delete
function bindPasswordRestLink() {
[97] Fix | Delete
$( '#generate-reset-link' ).on( 'click', function() {
[98] Fix | Delete
var $this = $(this),
[99] Fix | Delete
data = {
[100] Fix | Delete
'user_id': userProfileL10n.user_id, // The user to send a reset to.
[101] Fix | Delete
'nonce': userProfileL10n.nonce // Nonce to validate the action.
[102] Fix | Delete
};
[103] Fix | Delete
[104] Fix | Delete
// Remove any previous error messages.
[105] Fix | Delete
$this.parent().find( '.notice-error' ).remove();
[106] Fix | Delete
[107] Fix | Delete
// Send the reset request.
[108] Fix | Delete
var resetAction = wp.ajax.post( 'send-password-reset', data );
[109] Fix | Delete
[110] Fix | Delete
// Handle reset success.
[111] Fix | Delete
resetAction.done( function( response ) {
[112] Fix | Delete
addInlineNotice( $this, true, response );
[113] Fix | Delete
} );
[114] Fix | Delete
[115] Fix | Delete
// Handle reset failure.
[116] Fix | Delete
resetAction.fail( function( response ) {
[117] Fix | Delete
addInlineNotice( $this, false, response );
[118] Fix | Delete
} );
[119] Fix | Delete
[120] Fix | Delete
});
[121] Fix | Delete
[122] Fix | Delete
}
[123] Fix | Delete
[124] Fix | Delete
/**
[125] Fix | Delete
* Helper function to insert an inline notice of success or failure.
[126] Fix | Delete
*
[127] Fix | Delete
* @param {jQuery Object} $this The button element: the message will be inserted
[128] Fix | Delete
* above this button
[129] Fix | Delete
* @param {bool} success Whether the message is a success message.
[130] Fix | Delete
* @param {string} message The message to insert.
[131] Fix | Delete
*/
[132] Fix | Delete
function addInlineNotice( $this, success, message ) {
[133] Fix | Delete
var resultDiv = $( '<div />' );
[134] Fix | Delete
[135] Fix | Delete
// Set up the notice div.
[136] Fix | Delete
resultDiv.addClass( 'notice inline' );
[137] Fix | Delete
[138] Fix | Delete
// Add a class indicating success or failure.
[139] Fix | Delete
resultDiv.addClass( 'notice-' + ( success ? 'success' : 'error' ) );
[140] Fix | Delete
[141] Fix | Delete
// Add the message, wrapping in a p tag, with a fadein to highlight each message.
[142] Fix | Delete
resultDiv.text( $( $.parseHTML( message ) ).text() ).wrapInner( '<p />');
[143] Fix | Delete
[144] Fix | Delete
// Disable the button when the callback has succeeded.
[145] Fix | Delete
$this.prop( 'disabled', success );
[146] Fix | Delete
[147] Fix | Delete
// Remove any previous notices.
[148] Fix | Delete
$this.siblings( '.notice' ).remove();
[149] Fix | Delete
[150] Fix | Delete
// Insert the notice.
[151] Fix | Delete
$this.before( resultDiv );
[152] Fix | Delete
}
[153] Fix | Delete
[154] Fix | Delete
function bindPasswordForm() {
[155] Fix | Delete
var $generateButton,
[156] Fix | Delete
$cancelButton;
[157] Fix | Delete
[158] Fix | Delete
$pass1Row = $( '.user-pass1-wrap, .user-pass-wrap, .reset-pass-submit' );
[159] Fix | Delete
[160] Fix | Delete
// Hide the confirm password field when JavaScript support is enabled.
[161] Fix | Delete
$('.user-pass2-wrap').hide();
[162] Fix | Delete
[163] Fix | Delete
$submitButton = $( '#submit, #wp-submit' ).on( 'click', function () {
[164] Fix | Delete
updateLock = false;
[165] Fix | Delete
});
[166] Fix | Delete
[167] Fix | Delete
$submitButtons = $submitButton.add( ' #createusersub' );
[168] Fix | Delete
[169] Fix | Delete
$weakRow = $( '.pw-weak' );
[170] Fix | Delete
$weakCheckbox = $weakRow.find( '.pw-checkbox' );
[171] Fix | Delete
$weakCheckbox.on( 'change', function() {
[172] Fix | Delete
$submitButtons.prop( 'disabled', ! $weakCheckbox.prop( 'checked' ) );
[173] Fix | Delete
} );
[174] Fix | Delete
[175] Fix | Delete
$pass1 = $('#pass1');
[176] Fix | Delete
if ( $pass1.length ) {
[177] Fix | Delete
bindPass1();
[178] Fix | Delete
} else {
[179] Fix | Delete
// Password field for the login form.
[180] Fix | Delete
$pass1 = $( '#user_pass' );
[181] Fix | Delete
}
[182] Fix | Delete
[183] Fix | Delete
/*
[184] Fix | Delete
* Fix a LastPass mismatch issue, LastPass only changes pass2.
[185] Fix | Delete
*
[186] Fix | Delete
* This fixes the issue by copying any changes from the hidden
[187] Fix | Delete
* pass2 field to the pass1 field, then running check_pass_strength.
[188] Fix | Delete
*/
[189] Fix | Delete
$pass2 = $( '#pass2' ).on( 'input', function () {
[190] Fix | Delete
if ( $pass2.val().length > 0 ) {
[191] Fix | Delete
$pass1.val( $pass2.val() );
[192] Fix | Delete
$pass2.val('');
[193] Fix | Delete
currentPass = '';
[194] Fix | Delete
$pass1.trigger( 'pwupdate' );
[195] Fix | Delete
}
[196] Fix | Delete
} );
[197] Fix | Delete
[198] Fix | Delete
// Disable hidden inputs to prevent autofill and submission.
[199] Fix | Delete
if ( $pass1.is( ':hidden' ) ) {
[200] Fix | Delete
$pass1.prop( 'disabled', true );
[201] Fix | Delete
$pass2.prop( 'disabled', true );
[202] Fix | Delete
}
[203] Fix | Delete
[204] Fix | Delete
$passwordWrapper = $pass1Row.find( '.wp-pwd' );
[205] Fix | Delete
$generateButton = $pass1Row.find( 'button.wp-generate-pw' );
[206] Fix | Delete
[207] Fix | Delete
bindToggleButton();
[208] Fix | Delete
[209] Fix | Delete
$generateButton.show();
[210] Fix | Delete
$generateButton.on( 'click', function () {
[211] Fix | Delete
updateLock = true;
[212] Fix | Delete
[213] Fix | Delete
// Make sure the password fields are shown.
[214] Fix | Delete
$generateButton.attr( 'aria-expanded', 'true' );
[215] Fix | Delete
$passwordWrapper
[216] Fix | Delete
.show()
[217] Fix | Delete
.addClass( 'is-open' );
[218] Fix | Delete
[219] Fix | Delete
// Enable the inputs when showing.
[220] Fix | Delete
$pass1.attr( 'disabled', false );
[221] Fix | Delete
$pass2.attr( 'disabled', false );
[222] Fix | Delete
[223] Fix | Delete
// Set the password to the generated value.
[224] Fix | Delete
generatePassword();
[225] Fix | Delete
[226] Fix | Delete
// Show generated password in plaintext by default.
[227] Fix | Delete
resetToggle ( false );
[228] Fix | Delete
[229] Fix | Delete
// Generate the next password and cache.
[230] Fix | Delete
wp.ajax.post( 'generate-password' )
[231] Fix | Delete
.done( function( data ) {
[232] Fix | Delete
$pass1.data( 'pw', data );
[233] Fix | Delete
} );
[234] Fix | Delete
} );
[235] Fix | Delete
[236] Fix | Delete
$cancelButton = $pass1Row.find( 'button.wp-cancel-pw' );
[237] Fix | Delete
$cancelButton.on( 'click', function () {
[238] Fix | Delete
updateLock = false;
[239] Fix | Delete
[240] Fix | Delete
// Disable the inputs when hiding to prevent autofill and submission.
[241] Fix | Delete
$pass1.prop( 'disabled', true );
[242] Fix | Delete
$pass2.prop( 'disabled', true );
[243] Fix | Delete
[244] Fix | Delete
// Clear password field and update the UI.
[245] Fix | Delete
$pass1.val( '' ).trigger( 'pwupdate' );
[246] Fix | Delete
resetToggle( false );
[247] Fix | Delete
[248] Fix | Delete
// Hide password controls.
[249] Fix | Delete
$passwordWrapper
[250] Fix | Delete
.hide()
[251] Fix | Delete
.removeClass( 'is-open' );
[252] Fix | Delete
[253] Fix | Delete
// Stop an empty password from being submitted as a change.
[254] Fix | Delete
$submitButtons.prop( 'disabled', false );
[255] Fix | Delete
} );
[256] Fix | Delete
[257] Fix | Delete
$pass1Row.closest( 'form' ).on( 'submit', function () {
[258] Fix | Delete
updateLock = false;
[259] Fix | Delete
[260] Fix | Delete
$pass1.prop( 'disabled', false );
[261] Fix | Delete
$pass2.prop( 'disabled', false );
[262] Fix | Delete
$pass2.val( $pass1.val() );
[263] Fix | Delete
});
[264] Fix | Delete
}
[265] Fix | Delete
[266] Fix | Delete
function check_pass_strength() {
[267] Fix | Delete
var pass1 = $('#pass1').val(), strength;
[268] Fix | Delete
[269] Fix | Delete
$('#pass-strength-result').removeClass('short bad good strong empty');
[270] Fix | Delete
if ( ! pass1 || '' === pass1.trim() ) {
[271] Fix | Delete
$( '#pass-strength-result' ).addClass( 'empty' ).html( '&nbsp;' );
[272] Fix | Delete
return;
[273] Fix | Delete
}
[274] Fix | Delete
[275] Fix | Delete
strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputDisallowedList(), pass1 );
[276] Fix | Delete
[277] Fix | Delete
switch ( strength ) {
[278] Fix | Delete
case -1:
[279] Fix | Delete
$( '#pass-strength-result' ).addClass( 'bad' ).html( pwsL10n.unknown );
[280] Fix | Delete
break;
[281] Fix | Delete
case 2:
[282] Fix | Delete
$('#pass-strength-result').addClass('bad').html( pwsL10n.bad );
[283] Fix | Delete
break;
[284] Fix | Delete
case 3:
[285] Fix | Delete
$('#pass-strength-result').addClass('good').html( pwsL10n.good );
[286] Fix | Delete
break;
[287] Fix | Delete
case 4:
[288] Fix | Delete
$('#pass-strength-result').addClass('strong').html( pwsL10n.strong );
[289] Fix | Delete
break;
[290] Fix | Delete
case 5:
[291] Fix | Delete
$('#pass-strength-result').addClass('short').html( pwsL10n.mismatch );
[292] Fix | Delete
break;
[293] Fix | Delete
default:
[294] Fix | Delete
$('#pass-strength-result').addClass('short').html( pwsL10n['short'] );
[295] Fix | Delete
}
[296] Fix | Delete
}
[297] Fix | Delete
[298] Fix | Delete
function showOrHideWeakPasswordCheckbox() {
[299] Fix | Delete
var passStrength = $('#pass-strength-result')[0];
[300] Fix | Delete
[301] Fix | Delete
if ( passStrength.className ) {
[302] Fix | Delete
$pass1.addClass( passStrength.className );
[303] Fix | Delete
if ( $( passStrength ).is( '.short, .bad' ) ) {
[304] Fix | Delete
if ( ! $weakCheckbox.prop( 'checked' ) ) {
[305] Fix | Delete
$submitButtons.prop( 'disabled', true );
[306] Fix | Delete
}
[307] Fix | Delete
$weakRow.show();
[308] Fix | Delete
} else {
[309] Fix | Delete
if ( $( passStrength ).is( '.empty' ) ) {
[310] Fix | Delete
$submitButtons.prop( 'disabled', true );
[311] Fix | Delete
$weakCheckbox.prop( 'checked', false );
[312] Fix | Delete
} else {
[313] Fix | Delete
$submitButtons.prop( 'disabled', false );
[314] Fix | Delete
}
[315] Fix | Delete
$weakRow.hide();
[316] Fix | Delete
}
[317] Fix | Delete
}
[318] Fix | Delete
}
[319] Fix | Delete
[320] Fix | Delete
$(document).ready( function() {
[321] Fix | Delete
var $colorpicker, $stylesheet, user_id, current_user_id,
[322] Fix | Delete
select = $( '#display_name' ),
[323] Fix | Delete
current_name = select.val(),
[324] Fix | Delete
greeting = $( '#wp-admin-bar-my-account' ).find( '.display-name' );
[325] Fix | Delete
[326] Fix | Delete
$( '#pass1' ).val( '' ).on( 'input' + ' pwupdate', check_pass_strength );
[327] Fix | Delete
$('#pass-strength-result').show();
[328] Fix | Delete
$('.color-palette').on( 'click', function() {
[329] Fix | Delete
$(this).siblings('input[name="admin_color"]').prop('checked', true);
[330] Fix | Delete
});
[331] Fix | Delete
[332] Fix | Delete
if ( select.length ) {
[333] Fix | Delete
$('#first_name, #last_name, #nickname').on( 'blur.user_profile', function() {
[334] Fix | Delete
var dub = [],
[335] Fix | Delete
inputs = {
[336] Fix | Delete
display_nickname : $('#nickname').val() || '',
[337] Fix | Delete
display_username : $('#user_login').val() || '',
[338] Fix | Delete
display_firstname : $('#first_name').val() || '',
[339] Fix | Delete
display_lastname : $('#last_name').val() || ''
[340] Fix | Delete
};
[341] Fix | Delete
[342] Fix | Delete
if ( inputs.display_firstname && inputs.display_lastname ) {
[343] Fix | Delete
inputs.display_firstlast = inputs.display_firstname + ' ' + inputs.display_lastname;
[344] Fix | Delete
inputs.display_lastfirst = inputs.display_lastname + ' ' + inputs.display_firstname;
[345] Fix | Delete
}
[346] Fix | Delete
[347] Fix | Delete
$.each( $('option', select), function( i, el ){
[348] Fix | Delete
dub.push( el.value );
[349] Fix | Delete
});
[350] Fix | Delete
[351] Fix | Delete
$.each(inputs, function( id, value ) {
[352] Fix | Delete
if ( ! value ) {
[353] Fix | Delete
return;
[354] Fix | Delete
}
[355] Fix | Delete
[356] Fix | Delete
var val = value.replace(/<\/?[a-z][^>]*>/gi, '');
[357] Fix | Delete
[358] Fix | Delete
if ( inputs[id].length && $.inArray( val, dub ) === -1 ) {
[359] Fix | Delete
dub.push(val);
[360] Fix | Delete
$('<option />', {
[361] Fix | Delete
'text': val
[362] Fix | Delete
}).appendTo( select );
[363] Fix | Delete
}
[364] Fix | Delete
});
[365] Fix | Delete
});
[366] Fix | Delete
[367] Fix | Delete
/**
[368] Fix | Delete
* Replaces "Howdy, *" in the admin toolbar whenever the display name dropdown is updated for one's own profile.
[369] Fix | Delete
*/
[370] Fix | Delete
select.on( 'change', function() {
[371] Fix | Delete
if ( user_id !== current_user_id ) {
[372] Fix | Delete
return;
[373] Fix | Delete
}
[374] Fix | Delete
[375] Fix | Delete
var display_name = $.trim( this.value ) || current_name;
[376] Fix | Delete
[377] Fix | Delete
greeting.text( display_name );
[378] Fix | Delete
} );
[379] Fix | Delete
}
[380] Fix | Delete
[381] Fix | Delete
$colorpicker = $( '#color-picker' );
[382] Fix | Delete
$stylesheet = $( '#colors-css' );
[383] Fix | Delete
user_id = $( 'input#user_id' ).val();
[384] Fix | Delete
current_user_id = $( 'input[name="checkuser_id"]' ).val();
[385] Fix | Delete
[386] Fix | Delete
$colorpicker.on( 'click.colorpicker', '.color-option', function() {
[387] Fix | Delete
var colors,
[388] Fix | Delete
$this = $(this);
[389] Fix | Delete
[390] Fix | Delete
if ( $this.hasClass( 'selected' ) ) {
[391] Fix | Delete
return;
[392] Fix | Delete
}
[393] Fix | Delete
[394] Fix | Delete
$this.siblings( '.selected' ).removeClass( 'selected' );
[395] Fix | Delete
$this.addClass( 'selected' ).find( 'input[type="radio"]' ).prop( 'checked', true );
[396] Fix | Delete
[397] Fix | Delete
// Set color scheme.
[398] Fix | Delete
if ( user_id === current_user_id ) {
[399] Fix | Delete
// Load the colors stylesheet.
[400] Fix | Delete
// The default color scheme won't have one, so we'll need to create an element.
[401] Fix | Delete
if ( 0 === $stylesheet.length ) {
[402] Fix | Delete
$stylesheet = $( '<link rel="stylesheet" />' ).appendTo( 'head' );
[403] Fix | Delete
}
[404] Fix | Delete
$stylesheet.attr( 'href', $this.children( '.css_url' ).val() );
[405] Fix | Delete
[406] Fix | Delete
// Repaint icons.
[407] Fix | Delete
if ( typeof wp !== 'undefined' && wp.svgPainter ) {
[408] Fix | Delete
try {
[409] Fix | Delete
colors = JSON.parse( $this.children( '.icon_colors' ).val() );
[410] Fix | Delete
} catch ( error ) {}
[411] Fix | Delete
[412] Fix | Delete
if ( colors ) {
[413] Fix | Delete
wp.svgPainter.setColors( colors );
[414] Fix | Delete
wp.svgPainter.paint();
[415] Fix | Delete
}
[416] Fix | Delete
}
[417] Fix | Delete
[418] Fix | Delete
// Update user option.
[419] Fix | Delete
$.post( ajaxurl, {
[420] Fix | Delete
action: 'save-user-color-scheme',
[421] Fix | Delete
color_scheme: $this.children( 'input[name="admin_color"]' ).val(),
[422] Fix | Delete
nonce: $('#color-nonce').val()
[423] Fix | Delete
}).done( function( response ) {
[424] Fix | Delete
if ( response.success ) {
[425] Fix | Delete
$( 'body' ).removeClass( response.data.previousScheme ).addClass( response.data.currentScheme );
[426] Fix | Delete
}
[427] Fix | Delete
});
[428] Fix | Delete
}
[429] Fix | Delete
});
[430] Fix | Delete
[431] Fix | Delete
bindPasswordForm();
[432] Fix | Delete
bindPasswordRestLink();
[433] Fix | Delete
});
[434] Fix | Delete
[435] Fix | Delete
$( '#destroy-sessions' ).on( 'click', function( e ) {
[436] Fix | Delete
var $this = $(this);
[437] Fix | Delete
[438] Fix | Delete
wp.ajax.post( 'destroy-sessions', {
[439] Fix | Delete
nonce: $( '#_wpnonce' ).val(),
[440] Fix | Delete
user_id: $( '#user_id' ).val()
[441] Fix | Delete
}).done( function( response ) {
[442] Fix | Delete
$this.prop( 'disabled', true );
[443] Fix | Delete
$this.siblings( '.notice' ).remove();
[444] Fix | Delete
$this.before( '<div class="notice notice-success inline"><p>' + response.message + '</p></div>' );
[445] Fix | Delete
}).fail( function( response ) {
[446] Fix | Delete
$this.siblings( '.notice' ).remove();
[447] Fix | Delete
$this.before( '<div class="notice notice-error inline"><p>' + response.message + '</p></div>' );
[448] Fix | Delete
});
[449] Fix | Delete
[450] Fix | Delete
e.preventDefault();
[451] Fix | Delete
});
[452] Fix | Delete
[453] Fix | Delete
window.generatePassword = generatePassword;
[454] Fix | Delete
[455] Fix | Delete
// Warn the user if password was generated but not saved.
[456] Fix | Delete
$( window ).on( 'beforeunload', function () {
[457] Fix | Delete
if ( true === updateLock ) {
[458] Fix | Delete
return __( 'Your new password has not been saved.' );
[459] Fix | Delete
}
[460] Fix | Delete
} );
[461] Fix | Delete
[462] Fix | Delete
/*
[463] Fix | Delete
* We need to generate a password as soon as the Reset Password page is loaded,
[464] Fix | Delete
* to avoid double clicking the button to retrieve the first generated password.
[465] Fix | Delete
* See ticket #39638.
[466] Fix | Delete
*/
[467] Fix | Delete
$( document ).ready( function() {
[468] Fix | Delete
if ( $( '.reset-pass-submit' ).length ) {
[469] Fix | Delete
$( '.reset-pass-submit button.wp-generate-pw' ).trigger( 'click' );
[470] Fix | Delete
}
[471] Fix | Delete
});
[472] Fix | Delete
[473] Fix | Delete
})(jQuery);
[474] Fix | Delete
[475] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function