mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-13 15:20:06 +01:00
Users: Add JS confirmation if user profile has unsaved changes.
Add a confirmation dialog when users navigate away from the user profile screen if they have unsaved changes to prevent data loss. Props ashokrane, karlijnbk, diedeexterkate, jwgoedert, joedolson, swissspidy, afercia. Fixes #40493. Built from https://develop.svn.wordpress.org/trunk@58137 git-svn-id: http://core.svn.wordpress.org/trunk@57602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
fd4159ed87
commit
39c3bec9f3
@ -5,6 +5,7 @@
|
|||||||
/* global ajaxurl, pwsL10n, userProfileL10n */
|
/* global ajaxurl, pwsL10n, userProfileL10n */
|
||||||
(function($) {
|
(function($) {
|
||||||
var updateLock = false,
|
var updateLock = false,
|
||||||
|
isSubmitting = false,
|
||||||
__ = wp.i18n.__,
|
__ = wp.i18n.__,
|
||||||
$pass1Row,
|
$pass1Row,
|
||||||
$pass1,
|
$pass1,
|
||||||
@ -15,6 +16,8 @@
|
|||||||
$submitButtons,
|
$submitButtons,
|
||||||
$submitButton,
|
$submitButton,
|
||||||
currentPass,
|
currentPass,
|
||||||
|
$form,
|
||||||
|
originalFormContent,
|
||||||
$passwordWrapper;
|
$passwordWrapper;
|
||||||
|
|
||||||
function generatePassword() {
|
function generatePassword() {
|
||||||
@ -454,6 +457,12 @@
|
|||||||
|
|
||||||
bindPasswordForm();
|
bindPasswordForm();
|
||||||
bindPasswordResetLink();
|
bindPasswordResetLink();
|
||||||
|
$submitButtons.on( 'click', function() {
|
||||||
|
isSubmitting = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
$form = $( '#your-profile, #createuser' );
|
||||||
|
originalFormContent = $form.serialize();
|
||||||
});
|
});
|
||||||
|
|
||||||
$( '#destroy-sessions' ).on( 'click', function( e ) {
|
$( '#destroy-sessions' ).on( 'click', function( e ) {
|
||||||
@ -481,7 +490,10 @@
|
|||||||
if ( true === updateLock ) {
|
if ( true === updateLock ) {
|
||||||
return __( 'Your new password has not been saved.' );
|
return __( 'Your new password has not been saved.' );
|
||||||
}
|
}
|
||||||
} );
|
if ( originalFormContent !== $form.serialize() && ! isSubmitting ) {
|
||||||
|
return __( 'Changes that you made may not be saved.' );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We need to generate a password as soon as the Reset Password page is loaded,
|
* We need to generate a password as soon as the Reset Password page is loaded,
|
||||||
|
2
wp-admin/js/user-profile.min.js
vendored
2
wp-admin/js/user-profile.min.js
vendored
File diff suppressed because one or more lines are too long
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.6-alpha-58136';
|
$wp_version = '6.6-alpha-58137';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user