Ticket #40493: 40493.3.diff
| File 40493.3.diff, 1.2 KB (added by , 2 years ago) |
|---|
-
src/js/_enqueues/admin/user-profile.js
5 5 /* global ajaxurl, pwsL10n, userProfileL10n */ 6 6 (function($) { 7 7 var updateLock = false, 8 isSubmitting = false, 8 9 __ = wp.i18n.__, 9 10 $pass1Row, 10 11 $pass1, … … 15 16 $submitButtons, 16 17 $submitButton, 17 18 currentPass, 19 $form, 20 originalFormContent, 18 21 $passwordWrapper; 19 22 20 23 function generatePassword() { … … 454 457 455 458 bindPasswordForm(); 456 459 bindPasswordResetLink(); 460 $submitButtons.on( 'click', function() { 461 isSubmitting = true; 462 }); 463 464 $form = $( '#your-profile, #createuser' ); 465 originalFormContent = $form.serialize(); 457 466 }); 458 467 459 468 $( '#destroy-sessions' ).on( 'click', function( e ) { … … 481 490 if ( true === updateLock ) { 482 491 return __( 'Your new password has not been saved.' ); 483 492 } 484 } ); 493 if ( originalFormContent !== $form.serialize() && ! isSubmitting ) { 494 return __( 'Changes that you made may not be saved.' ); 495 } 496 }); 485 497 486 498 /* 487 499 * We need to generate a password as soon as the Reset Password page is loaded,