From ac4f65c34cb65791421b523ea085f6d27364f5fb Mon Sep 17 00:00:00 2001 From: Sainath Poojary Date: Fri, 11 Jul 2025 12:56:34 +0530 Subject: [PATCH 1/2] Users: Prevent false unsaved changes warning on Add User screen. --- src/js/_enqueues/admin/user-profile.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/js/_enqueues/admin/user-profile.js b/src/js/_enqueues/admin/user-profile.js index ce680ef4c4298..7fa2b3744aeb9 100644 --- a/src/js/_enqueues/admin/user-profile.js +++ b/src/js/_enqueues/admin/user-profile.js @@ -67,6 +67,7 @@ if ( 1 === parseInt( $pass1.data( 'reveal' ), 10 ) ) { generatePassword(); + originalFormContent = $form.serialize(); } $pass1.on( 'input' + ' pwupdate', function () { From d33bb7b42f287548cb8a172973bfca95edb69448 Mon Sep 17 00:00:00 2001 From: Sainath Poojary Date: Fri, 11 Jul 2025 13:07:24 +0530 Subject: [PATCH 2/2] Users: Move form serialize into `generatePassword()` --- src/js/_enqueues/admin/user-profile.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js/_enqueues/admin/user-profile.js b/src/js/_enqueues/admin/user-profile.js index 7fa2b3744aeb9..e076cd77b9227 100644 --- a/src/js/_enqueues/admin/user-profile.js +++ b/src/js/_enqueues/admin/user-profile.js @@ -60,6 +60,10 @@ if ( 'mailserver_pass' !== $pass1.prop('id' ) && ! $('#weblog_title').length ) { $( $pass1 ).trigger( 'focus' ); } + + if ( $form && $form.length ) { + originalFormContent = $form.serialize(); + } } function bindPass1() { @@ -67,7 +71,6 @@ if ( 1 === parseInt( $pass1.data( 'reveal' ), 10 ) ) { generatePassword(); - originalFormContent = $form.serialize(); } $pass1.on( 'input' + ' pwupdate', function () {