2018-06-28 04:30:15 +02:00
|
|
|
/**
|
|
|
|
* @output wp-admin/js/user-profile.js
|
|
|
|
*/
|
|
|
|
|
Users: enable admins to send users a reset password link.
Add a feature so Admins can send users a 'password reset' email. This doesn't change the password or force a password change. It only emails the user the password reset link.
The feature appears in several places:
* A "Send Reset Link" button on user profile screen.
* A "Send password reset" option in the user list bulk action dropdown.
* A "Send password reset" quick action when hovering over a username in the user list.
Props Ipstenu, DrewAPicture, eventualo, wonderboymusic, knutsp, ericlewis, afercia, JoshuaWold, johnbillion, paaljoachim, hedgefield.
Fixes #34281.
Built from https://develop.svn.wordpress.org/trunk@50129
git-svn-id: http://core.svn.wordpress.org/trunk@49808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-01 23:13:03 +01:00
|
|
|
/* global ajaxurl, pwsL10n, userProfileL10n */
|
2015-07-27 23:25:25 +02:00
|
|
|
(function($) {
|
|
|
|
var updateLock = false,
|
2024-05-12 20:45:14 +02:00
|
|
|
isSubmitting = false,
|
2020-07-01 22:38:01 +02:00
|
|
|
__ = wp.i18n.__,
|
2015-07-27 23:25:25 +02:00
|
|
|
$pass1Row,
|
|
|
|
$pass1,
|
|
|
|
$pass2,
|
|
|
|
$weakRow,
|
|
|
|
$weakCheckbox,
|
2015-07-29 21:22:26 +02:00
|
|
|
$toggleButton,
|
2015-07-27 23:25:25 +02:00
|
|
|
$submitButtons,
|
2015-07-29 05:27:25 +02:00
|
|
|
$submitButton,
|
2020-10-20 20:27:13 +02:00
|
|
|
currentPass,
|
2024-05-12 20:45:14 +02:00
|
|
|
$form,
|
|
|
|
originalFormContent,
|
2020-10-20 20:27:13 +02:00
|
|
|
$passwordWrapper;
|
2015-07-27 23:25:25 +02:00
|
|
|
|
|
|
|
function generatePassword() {
|
|
|
|
if ( typeof zxcvbn !== 'function' ) {
|
2015-07-29 05:27:25 +02:00
|
|
|
setTimeout( generatePassword, 50 );
|
2016-07-01 14:45:29 +02:00
|
|
|
return;
|
2020-10-20 20:27:13 +02:00
|
|
|
} else if ( ! $pass1.val() || $passwordWrapper.hasClass( 'is-open' ) ) {
|
|
|
|
// zxcvbn loaded before user entered password, or generating new password.
|
2015-07-29 05:27:25 +02:00
|
|
|
$pass1.val( $pass1.data( 'pw' ) );
|
2016-07-01 14:45:29 +02:00
|
|
|
$pass1.trigger( 'pwupdate' );
|
|
|
|
showOrHideWeakPasswordCheckbox();
|
2020-10-20 20:27:13 +02:00
|
|
|
} else {
|
2016-07-01 14:45:29 +02:00
|
|
|
// zxcvbn loaded after the user entered password, check strength.
|
|
|
|
check_pass_strength();
|
|
|
|
showOrHideWeakPasswordCheckbox();
|
2015-07-01 16:48:24 +02:00
|
|
|
}
|
2016-07-01 14:45:29 +02:00
|
|
|
|
Upgrade/Install/Users: Prevent JS bug filling new passwords.
A JavaScript race condition was throwing an error and preventing passwords from being set if the zxcvbn library loaded earlier than expected. This could prevent the installation of WordPress or the creation/updating of user accounts.
Props adi64bit, afragen, agepcom, audrasjb, bedas, brookedot, cbigler, charlyox, costdev, desrosj, drago239, Eric3D, espiat, jadpm, jrf, justinahinon, kubiq, lkraav, michelangelovandam, mirkolofio, mkox, peterwilsoncc, poena, sbossarte, sebastienserre, SergeyBiryukov, Synchro, thomasplevy, walbo, waterfire, wpmakenorg.
Fixes #53974, #52086.
Built from https://develop.svn.wordpress.org/trunk@53122
git-svn-id: http://core.svn.wordpress.org/trunk@52711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-11 06:29:04 +02:00
|
|
|
/*
|
|
|
|
* This works around a race condition when zxcvbn loads quickly and
|
|
|
|
* causes `generatePassword()` to run prior to the toggle button being
|
|
|
|
* bound.
|
|
|
|
*/
|
|
|
|
bindToggleButton();
|
|
|
|
|
2020-10-20 20:27:13 +02:00
|
|
|
// Install screen.
|
2016-07-01 14:45:29 +02:00
|
|
|
if ( 1 !== parseInt( $toggleButton.data( 'start-masked' ), 10 ) ) {
|
2020-10-20 20:27:13 +02:00
|
|
|
// Show the password not masked if admin_password hasn't been posted yet.
|
Login and Registration: Add a "Show password" button on the login page.
The ability for users to see the password they're typing improves usability and accessibility of the login users flow.
- brings the login screen in line with the same feature already used in the New User, Edit User, and Reset Password pages
- improves association of labels and input fields by using explicit association with `for` / `id` attributes
- slightly increases the "Remember me" label font size
Props johnbillion, Iceable, audrasjb, joyously, adamsilverstein, boemedia, DrewAPicture, shadyvb, birgire, peterwilsoncc, pento, anevins, davidbaumwald, whyisjake, afercia.
Fixes #42888.
Built from https://develop.svn.wordpress.org/trunk@46256
git-svn-id: http://core.svn.wordpress.org/trunk@46068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-23 20:06:57 +02:00
|
|
|
$pass1.attr( 'type', 'text' );
|
2016-07-01 14:45:29 +02:00
|
|
|
} else {
|
2020-10-20 20:27:13 +02:00
|
|
|
// Otherwise, mask the password.
|
2016-07-01 14:45:29 +02:00
|
|
|
$toggleButton.trigger( 'click' );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Once zxcvbn loads, passwords strength is known.
|
2020-07-01 22:38:01 +02:00
|
|
|
$( '#pw-weak-text-label' ).text( __( 'Confirm use of weak password' ) );
|
2021-11-17 01:14:01 +01:00
|
|
|
|
|
|
|
// Focus the password field.
|
Administration: Hide password in options/writing.
Hide the password for the "Post via e-mail" settings in writing options. Use the same password hiding mechanisms in use elsewhere in core.
Props mastrup, denis-de-bernardy, ryan, brookedot, wojtek.szkutnik, dd32, sabreuse, sergeybiryukov, costdev, peterwilsoncc, zgrkaralar, clorith, renyot, sabernhardt, boniu91, ironprogrammer, bgoewert.
Fixes #9883.
Built from https://develop.svn.wordpress.org/trunk@55974
git-svn-id: http://core.svn.wordpress.org/trunk@55486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 02:32:21 +02:00
|
|
|
if ( 'mailserver_pass' !== $pass1.prop('id' ) ) {
|
|
|
|
$( $pass1 ).trigger( 'focus' );
|
|
|
|
}
|
2015-07-27 23:25:25 +02:00
|
|
|
}
|
2015-07-01 16:48:24 +02:00
|
|
|
|
2015-07-27 23:25:25 +02:00
|
|
|
function bindPass1() {
|
2015-07-29 05:27:25 +02:00
|
|
|
currentPass = $pass1.val();
|
2015-07-01 16:48:24 +02:00
|
|
|
|
2015-07-27 23:25:25 +02:00
|
|
|
if ( 1 === parseInt( $pass1.data( 'reveal' ), 10 ) ) {
|
|
|
|
generatePassword();
|
|
|
|
}
|
2015-07-22 18:56:27 +02:00
|
|
|
|
2019-01-10 03:57:50 +01:00
|
|
|
$pass1.on( 'input' + ' pwupdate', function () {
|
2015-07-28 23:11:26 +02:00
|
|
|
if ( $pass1.val() === currentPass ) {
|
|
|
|
return;
|
|
|
|
}
|
2015-07-01 16:48:24 +02:00
|
|
|
|
2015-07-28 23:11:26 +02:00
|
|
|
currentPass = $pass1.val();
|
Login and Registration: Add a "Show password" button on the login page.
The ability for users to see the password they're typing improves usability and accessibility of the login users flow.
- brings the login screen in line with the same feature already used in the New User, Edit User, and Reset Password pages
- improves association of labels and input fields by using explicit association with `for` / `id` attributes
- slightly increases the "Remember me" label font size
Props johnbillion, Iceable, audrasjb, joyously, adamsilverstein, boemedia, DrewAPicture, shadyvb, birgire, peterwilsoncc, pento, anevins, davidbaumwald, whyisjake, afercia.
Fixes #42888.
Built from https://develop.svn.wordpress.org/trunk@46256
git-svn-id: http://core.svn.wordpress.org/trunk@46068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-23 20:06:57 +02:00
|
|
|
|
2020-10-20 20:27:13 +02:00
|
|
|
// Refresh password strength area.
|
Login and Registration: Add a "Show password" button on the login page.
The ability for users to see the password they're typing improves usability and accessibility of the login users flow.
- brings the login screen in line with the same feature already used in the New User, Edit User, and Reset Password pages
- improves association of labels and input fields by using explicit association with `for` / `id` attributes
- slightly increases the "Remember me" label font size
Props johnbillion, Iceable, audrasjb, joyously, adamsilverstein, boemedia, DrewAPicture, shadyvb, birgire, peterwilsoncc, pento, anevins, davidbaumwald, whyisjake, afercia.
Fixes #42888.
Built from https://develop.svn.wordpress.org/trunk@46256
git-svn-id: http://core.svn.wordpress.org/trunk@46068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-23 20:06:57 +02:00
|
|
|
$pass1.removeClass( 'short bad good strong' );
|
2016-07-01 14:45:29 +02:00
|
|
|
showOrHideWeakPasswordCheckbox();
|
2015-07-01 16:48:24 +02:00
|
|
|
} );
|
2015-07-27 23:25:25 +02:00
|
|
|
}
|
2015-07-01 16:48:24 +02:00
|
|
|
|
Login and Registration: Add a "Show password" button on the login page.
The ability for users to see the password they're typing improves usability and accessibility of the login users flow.
- brings the login screen in line with the same feature already used in the New User, Edit User, and Reset Password pages
- improves association of labels and input fields by using explicit association with `for` / `id` attributes
- slightly increases the "Remember me" label font size
Props johnbillion, Iceable, audrasjb, joyously, adamsilverstein, boemedia, DrewAPicture, shadyvb, birgire, peterwilsoncc, pento, anevins, davidbaumwald, whyisjake, afercia.
Fixes #42888.
Built from https://develop.svn.wordpress.org/trunk@46256
git-svn-id: http://core.svn.wordpress.org/trunk@46068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-23 20:06:57 +02:00
|
|
|
function resetToggle( show ) {
|
2015-09-25 15:54:24 +02:00
|
|
|
$toggleButton
|
|
|
|
.attr({
|
2020-07-01 22:38:01 +02:00
|
|
|
'aria-label': show ? __( 'Show password' ) : __( 'Hide password' )
|
2015-09-25 15:54:24 +02:00
|
|
|
})
|
|
|
|
.find( '.text' )
|
2020-07-01 22:38:01 +02:00
|
|
|
.text( show ? __( 'Show' ) : __( 'Hide' ) )
|
2015-09-25 15:54:24 +02:00
|
|
|
.end()
|
|
|
|
.find( '.dashicons' )
|
Login and Registration: Add a "Show password" button on the login page.
The ability for users to see the password they're typing improves usability and accessibility of the login users flow.
- brings the login screen in line with the same feature already used in the New User, Edit User, and Reset Password pages
- improves association of labels and input fields by using explicit association with `for` / `id` attributes
- slightly increases the "Remember me" label font size
Props johnbillion, Iceable, audrasjb, joyously, adamsilverstein, boemedia, DrewAPicture, shadyvb, birgire, peterwilsoncc, pento, anevins, davidbaumwald, whyisjake, afercia.
Fixes #42888.
Built from https://develop.svn.wordpress.org/trunk@46256
git-svn-id: http://core.svn.wordpress.org/trunk@46068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-23 20:06:57 +02:00
|
|
|
.removeClass( show ? 'dashicons-hidden' : 'dashicons-visibility' )
|
|
|
|
.addClass( show ? 'dashicons-visibility' : 'dashicons-hidden' );
|
2015-09-25 15:54:24 +02:00
|
|
|
}
|
|
|
|
|
2015-07-27 23:25:25 +02:00
|
|
|
function bindToggleButton() {
|
Upgrade/Install/Users: Prevent JS bug filling new passwords.
A JavaScript race condition was throwing an error and preventing passwords from being set if the zxcvbn library loaded earlier than expected. This could prevent the installation of WordPress or the creation/updating of user accounts.
Props adi64bit, afragen, agepcom, audrasjb, bedas, brookedot, cbigler, charlyox, costdev, desrosj, drago239, Eric3D, espiat, jadpm, jrf, justinahinon, kubiq, lkraav, michelangelovandam, mirkolofio, mkox, peterwilsoncc, poena, sbossarte, sebastienserre, SergeyBiryukov, Synchro, thomasplevy, walbo, waterfire, wpmakenorg.
Fixes #53974, #52086.
Built from https://develop.svn.wordpress.org/trunk@53122
git-svn-id: http://core.svn.wordpress.org/trunk@52711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-11 06:29:04 +02:00
|
|
|
if ( !! $toggleButton ) {
|
|
|
|
// Do not rebind.
|
|
|
|
return;
|
|
|
|
}
|
2015-07-29 21:22:26 +02:00
|
|
|
$toggleButton = $pass1Row.find('.wp-hide-pw');
|
|
|
|
$toggleButton.show().on( 'click', function () {
|
Login and Registration: Add a "Show password" button on the login page.
The ability for users to see the password they're typing improves usability and accessibility of the login users flow.
- brings the login screen in line with the same feature already used in the New User, Edit User, and Reset Password pages
- improves association of labels and input fields by using explicit association with `for` / `id` attributes
- slightly increases the "Remember me" label font size
Props johnbillion, Iceable, audrasjb, joyously, adamsilverstein, boemedia, DrewAPicture, shadyvb, birgire, peterwilsoncc, pento, anevins, davidbaumwald, whyisjake, afercia.
Fixes #42888.
Built from https://develop.svn.wordpress.org/trunk@46256
git-svn-id: http://core.svn.wordpress.org/trunk@46068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-23 20:06:57 +02:00
|
|
|
if ( 'password' === $pass1.attr( 'type' ) ) {
|
|
|
|
$pass1.attr( 'type', 'text' );
|
|
|
|
resetToggle( false );
|
|
|
|
} else {
|
|
|
|
$pass1.attr( 'type', 'password' );
|
|
|
|
resetToggle( true );
|
|
|
|
}
|
2015-07-27 23:25:25 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
Users: enable admins to send users a reset password link.
Add a feature so Admins can send users a 'password reset' email. This doesn't change the password or force a password change. It only emails the user the password reset link.
The feature appears in several places:
* A "Send Reset Link" button on user profile screen.
* A "Send password reset" option in the user list bulk action dropdown.
* A "Send password reset" quick action when hovering over a username in the user list.
Props Ipstenu, DrewAPicture, eventualo, wonderboymusic, knutsp, ericlewis, afercia, JoshuaWold, johnbillion, paaljoachim, hedgefield.
Fixes #34281.
Built from https://develop.svn.wordpress.org/trunk@50129
git-svn-id: http://core.svn.wordpress.org/trunk@49808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-01 23:13:03 +01:00
|
|
|
/**
|
|
|
|
* Handle the password reset button. Sets up an ajax callback to trigger sending
|
|
|
|
* a password reset email.
|
|
|
|
*/
|
2021-08-02 18:48:57 +02:00
|
|
|
function bindPasswordResetLink() {
|
Users: enable admins to send users a reset password link.
Add a feature so Admins can send users a 'password reset' email. This doesn't change the password or force a password change. It only emails the user the password reset link.
The feature appears in several places:
* A "Send Reset Link" button on user profile screen.
* A "Send password reset" option in the user list bulk action dropdown.
* A "Send password reset" quick action when hovering over a username in the user list.
Props Ipstenu, DrewAPicture, eventualo, wonderboymusic, knutsp, ericlewis, afercia, JoshuaWold, johnbillion, paaljoachim, hedgefield.
Fixes #34281.
Built from https://develop.svn.wordpress.org/trunk@50129
git-svn-id: http://core.svn.wordpress.org/trunk@49808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-01 23:13:03 +01:00
|
|
|
$( '#generate-reset-link' ).on( 'click', function() {
|
|
|
|
var $this = $(this),
|
|
|
|
data = {
|
|
|
|
'user_id': userProfileL10n.user_id, // The user to send a reset to.
|
|
|
|
'nonce': userProfileL10n.nonce // Nonce to validate the action.
|
|
|
|
};
|
|
|
|
|
|
|
|
// Remove any previous error messages.
|
|
|
|
$this.parent().find( '.notice-error' ).remove();
|
|
|
|
|
|
|
|
// Send the reset request.
|
|
|
|
var resetAction = wp.ajax.post( 'send-password-reset', data );
|
|
|
|
|
|
|
|
// Handle reset success.
|
|
|
|
resetAction.done( function( response ) {
|
|
|
|
addInlineNotice( $this, true, response );
|
|
|
|
} );
|
|
|
|
|
|
|
|
// Handle reset failure.
|
|
|
|
resetAction.fail( function( response ) {
|
|
|
|
addInlineNotice( $this, false, response );
|
|
|
|
} );
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper function to insert an inline notice of success or failure.
|
|
|
|
*
|
|
|
|
* @param {jQuery Object} $this The button element: the message will be inserted
|
|
|
|
* above this button
|
|
|
|
* @param {bool} success Whether the message is a success message.
|
|
|
|
* @param {string} message The message to insert.
|
|
|
|
*/
|
|
|
|
function addInlineNotice( $this, success, message ) {
|
2024-06-21 20:17:14 +02:00
|
|
|
var resultDiv = $( '<div />', {
|
|
|
|
role: 'alert'
|
|
|
|
} );
|
Users: enable admins to send users a reset password link.
Add a feature so Admins can send users a 'password reset' email. This doesn't change the password or force a password change. It only emails the user the password reset link.
The feature appears in several places:
* A "Send Reset Link" button on user profile screen.
* A "Send password reset" option in the user list bulk action dropdown.
* A "Send password reset" quick action when hovering over a username in the user list.
Props Ipstenu, DrewAPicture, eventualo, wonderboymusic, knutsp, ericlewis, afercia, JoshuaWold, johnbillion, paaljoachim, hedgefield.
Fixes #34281.
Built from https://develop.svn.wordpress.org/trunk@50129
git-svn-id: http://core.svn.wordpress.org/trunk@49808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-01 23:13:03 +01:00
|
|
|
|
|
|
|
// Set up the notice div.
|
|
|
|
resultDiv.addClass( 'notice inline' );
|
|
|
|
|
|
|
|
// Add a class indicating success or failure.
|
|
|
|
resultDiv.addClass( 'notice-' + ( success ? 'success' : 'error' ) );
|
|
|
|
|
|
|
|
// Add the message, wrapping in a p tag, with a fadein to highlight each message.
|
|
|
|
resultDiv.text( $( $.parseHTML( message ) ).text() ).wrapInner( '<p />');
|
|
|
|
|
|
|
|
// Disable the button when the callback has succeeded.
|
|
|
|
$this.prop( 'disabled', success );
|
|
|
|
|
|
|
|
// Remove any previous notices.
|
|
|
|
$this.siblings( '.notice' ).remove();
|
|
|
|
|
|
|
|
// Insert the notice.
|
|
|
|
$this.before( resultDiv );
|
|
|
|
}
|
|
|
|
|
2015-07-27 23:25:25 +02:00
|
|
|
function bindPasswordForm() {
|
2020-10-20 20:27:13 +02:00
|
|
|
var $generateButton,
|
2015-07-27 23:25:25 +02:00
|
|
|
$cancelButton;
|
|
|
|
|
Administration: Hide password in options/writing.
Hide the password for the "Post via e-mail" settings in writing options. Use the same password hiding mechanisms in use elsewhere in core.
Props mastrup, denis-de-bernardy, ryan, brookedot, wojtek.szkutnik, dd32, sabreuse, sergeybiryukov, costdev, peterwilsoncc, zgrkaralar, clorith, renyot, sabernhardt, boniu91, ironprogrammer, bgoewert.
Fixes #9883.
Built from https://develop.svn.wordpress.org/trunk@55974
git-svn-id: http://core.svn.wordpress.org/trunk@55486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 02:32:21 +02:00
|
|
|
$pass1Row = $( '.user-pass1-wrap, .user-pass-wrap, .mailserver-pass-wrap, .reset-pass-submit' );
|
2015-09-12 00:52:26 +02:00
|
|
|
|
Login and Registration: Add a "Show password" button on the login page.
The ability for users to see the password they're typing improves usability and accessibility of the login users flow.
- brings the login screen in line with the same feature already used in the New User, Edit User, and Reset Password pages
- improves association of labels and input fields by using explicit association with `for` / `id` attributes
- slightly increases the "Remember me" label font size
Props johnbillion, Iceable, audrasjb, joyously, adamsilverstein, boemedia, DrewAPicture, shadyvb, birgire, peterwilsoncc, pento, anevins, davidbaumwald, whyisjake, afercia.
Fixes #42888.
Built from https://develop.svn.wordpress.org/trunk@46256
git-svn-id: http://core.svn.wordpress.org/trunk@46068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-23 20:06:57 +02:00
|
|
|
// Hide the confirm password field when JavaScript support is enabled.
|
2015-07-27 23:25:25 +02:00
|
|
|
$('.user-pass2-wrap').hide();
|
|
|
|
|
2017-09-21 23:29:48 +02:00
|
|
|
$submitButton = $( '#submit, #wp-submit' ).on( 'click', function () {
|
2015-07-27 23:25:25 +02:00
|
|
|
updateLock = false;
|
|
|
|
});
|
|
|
|
|
|
|
|
$submitButtons = $submitButton.add( ' #createusersub' );
|
|
|
|
|
|
|
|
$weakRow = $( '.pw-weak' );
|
|
|
|
$weakCheckbox = $weakRow.find( '.pw-checkbox' );
|
2021-01-22 13:32:03 +01:00
|
|
|
$weakCheckbox.on( 'change', function() {
|
2015-07-27 23:25:25 +02:00
|
|
|
$submitButtons.prop( 'disabled', ! $weakCheckbox.prop( 'checked' ) );
|
2015-07-01 16:48:24 +02:00
|
|
|
} );
|
|
|
|
|
Administration: Hide password in options/writing.
Hide the password for the "Post via e-mail" settings in writing options. Use the same password hiding mechanisms in use elsewhere in core.
Props mastrup, denis-de-bernardy, ryan, brookedot, wojtek.szkutnik, dd32, sabreuse, sergeybiryukov, costdev, peterwilsoncc, zgrkaralar, clorith, renyot, sabernhardt, boniu91, ironprogrammer, bgoewert.
Fixes #9883.
Built from https://develop.svn.wordpress.org/trunk@55974
git-svn-id: http://core.svn.wordpress.org/trunk@55486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 02:32:21 +02:00
|
|
|
$pass1 = $('#pass1, #mailserver_pass');
|
2015-07-27 23:25:25 +02:00
|
|
|
if ( $pass1.length ) {
|
|
|
|
bindPass1();
|
Login and Registration: Add a "Show password" button on the login page.
The ability for users to see the password they're typing improves usability and accessibility of the login users flow.
- brings the login screen in line with the same feature already used in the New User, Edit User, and Reset Password pages
- improves association of labels and input fields by using explicit association with `for` / `id` attributes
- slightly increases the "Remember me" label font size
Props johnbillion, Iceable, audrasjb, joyously, adamsilverstein, boemedia, DrewAPicture, shadyvb, birgire, peterwilsoncc, pento, anevins, davidbaumwald, whyisjake, afercia.
Fixes #42888.
Built from https://develop.svn.wordpress.org/trunk@46256
git-svn-id: http://core.svn.wordpress.org/trunk@46068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-23 20:06:57 +02:00
|
|
|
} else {
|
|
|
|
// Password field for the login form.
|
|
|
|
$pass1 = $( '#user_pass' );
|
2015-07-27 23:25:25 +02:00
|
|
|
}
|
|
|
|
|
2020-10-20 20:27:13 +02:00
|
|
|
/*
|
2015-07-01 16:48:24 +02:00
|
|
|
* Fix a LastPass mismatch issue, LastPass only changes pass2.
|
|
|
|
*
|
|
|
|
* This fixes the issue by copying any changes from the hidden
|
2015-07-29 05:27:25 +02:00
|
|
|
* pass2 field to the pass1 field, then running check_pass_strength.
|
2015-07-01 16:48:24 +02:00
|
|
|
*/
|
2019-01-10 03:57:50 +01:00
|
|
|
$pass2 = $( '#pass2' ).on( 'input', function () {
|
2015-07-27 23:25:25 +02:00
|
|
|
if ( $pass2.val().length > 0 ) {
|
|
|
|
$pass1.val( $pass2.val() );
|
2015-07-29 05:27:25 +02:00
|
|
|
$pass2.val('');
|
|
|
|
currentPass = '';
|
|
|
|
$pass1.trigger( 'pwupdate' );
|
2015-07-23 07:00:25 +02:00
|
|
|
}
|
2015-07-01 16:48:24 +02:00
|
|
|
} );
|
|
|
|
|
2015-11-16 21:49:26 +01:00
|
|
|
// Disable hidden inputs to prevent autofill and submission.
|
|
|
|
if ( $pass1.is( ':hidden' ) ) {
|
|
|
|
$pass1.prop( 'disabled', true );
|
|
|
|
$pass2.prop( 'disabled', true );
|
|
|
|
}
|
2015-11-10 21:41:26 +01:00
|
|
|
|
2015-09-22 05:57:24 +02:00
|
|
|
$passwordWrapper = $pass1Row.find( '.wp-pwd' );
|
|
|
|
$generateButton = $pass1Row.find( 'button.wp-generate-pw' );
|
2015-07-27 23:25:25 +02:00
|
|
|
|
|
|
|
bindToggleButton();
|
|
|
|
|
2015-09-22 05:57:24 +02:00
|
|
|
$generateButton.show();
|
2015-07-27 23:25:25 +02:00
|
|
|
$generateButton.on( 'click', function () {
|
|
|
|
updateLock = true;
|
|
|
|
|
2020-10-20 20:27:13 +02:00
|
|
|
// Make sure the password fields are shown.
|
2022-01-05 18:37:03 +01:00
|
|
|
$generateButton.not( '.skip-aria-expanded' ).attr( 'aria-expanded', 'true' );
|
2020-10-20 20:27:13 +02:00
|
|
|
$passwordWrapper
|
|
|
|
.show()
|
|
|
|
.addClass( 'is-open' );
|
2015-07-27 23:25:25 +02:00
|
|
|
|
2015-11-10 21:41:26 +01:00
|
|
|
// Enable the inputs when showing.
|
|
|
|
$pass1.attr( 'disabled', false );
|
|
|
|
$pass2.attr( 'disabled', false );
|
|
|
|
|
2020-10-20 20:27:13 +02:00
|
|
|
// Set the password to the generated value.
|
|
|
|
generatePassword();
|
2015-07-01 16:48:24 +02:00
|
|
|
|
2020-10-20 20:27:13 +02:00
|
|
|
// Show generated password in plaintext by default.
|
|
|
|
resetToggle ( false );
|
2015-09-18 22:14:24 +02:00
|
|
|
|
2020-10-20 20:27:13 +02:00
|
|
|
// Generate the next password and cache.
|
2015-09-18 22:14:24 +02:00
|
|
|
wp.ajax.post( 'generate-password' )
|
|
|
|
.done( function( data ) {
|
|
|
|
$pass1.data( 'pw', data );
|
|
|
|
} );
|
2020-10-20 20:27:13 +02:00
|
|
|
} );
|
2015-09-18 22:14:24 +02:00
|
|
|
|
2020-10-20 20:27:13 +02:00
|
|
|
$cancelButton = $pass1Row.find( 'button.wp-cancel-pw' );
|
|
|
|
$cancelButton.on( 'click', function () {
|
|
|
|
updateLock = false;
|
2015-12-11 22:54:27 +01:00
|
|
|
|
2015-11-10 21:41:26 +01:00
|
|
|
// Disable the inputs when hiding to prevent autofill and submission.
|
|
|
|
$pass1.prop( 'disabled', true );
|
|
|
|
$pass2.prop( 'disabled', true );
|
|
|
|
|
2020-10-20 20:27:13 +02:00
|
|
|
// Clear password field and update the UI.
|
|
|
|
$pass1.val( '' ).trigger( 'pwupdate' );
|
Login and Registration: Add a "Show password" button on the login page.
The ability for users to see the password they're typing improves usability and accessibility of the login users flow.
- brings the login screen in line with the same feature already used in the New User, Edit User, and Reset Password pages
- improves association of labels and input fields by using explicit association with `for` / `id` attributes
- slightly increases the "Remember me" label font size
Props johnbillion, Iceable, audrasjb, joyously, adamsilverstein, boemedia, DrewAPicture, shadyvb, birgire, peterwilsoncc, pento, anevins, davidbaumwald, whyisjake, afercia.
Fixes #42888.
Built from https://develop.svn.wordpress.org/trunk@46256
git-svn-id: http://core.svn.wordpress.org/trunk@46068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-23 20:06:57 +02:00
|
|
|
resetToggle( false );
|
2015-09-25 15:54:24 +02:00
|
|
|
|
2020-10-20 20:27:13 +02:00
|
|
|
// Hide password controls.
|
|
|
|
$passwordWrapper
|
|
|
|
.hide()
|
|
|
|
.removeClass( 'is-open' );
|
|
|
|
|
|
|
|
// Stop an empty password from being submitted as a change.
|
|
|
|
$submitButtons.prop( 'disabled', false );
|
2022-01-05 18:37:03 +01:00
|
|
|
|
|
|
|
$generateButton.attr( 'aria-expanded', 'false' );
|
2015-07-27 23:25:25 +02:00
|
|
|
} );
|
2015-07-22 18:56:27 +02:00
|
|
|
|
2016-09-01 14:24:29 +02:00
|
|
|
$pass1Row.closest( 'form' ).on( 'submit', function () {
|
2015-07-27 23:25:25 +02:00
|
|
|
updateLock = false;
|
2015-07-22 18:56:27 +02:00
|
|
|
|
2015-11-24 22:17:27 +01:00
|
|
|
$pass1.prop( 'disabled', false );
|
|
|
|
$pass2.prop( 'disabled', false );
|
2015-07-27 23:25:25 +02:00
|
|
|
$pass2.val( $pass1.val() );
|
2015-07-01 16:48:24 +02:00
|
|
|
});
|
2015-07-27 23:25:25 +02:00
|
|
|
}
|
2012-08-23 02:04:18 +02:00
|
|
|
|
|
|
|
function check_pass_strength() {
|
2015-07-29 06:30:24 +02:00
|
|
|
var pass1 = $('#pass1').val(), strength;
|
2012-08-23 02:04:18 +02:00
|
|
|
|
2019-09-13 20:30:55 +02:00
|
|
|
$('#pass-strength-result').removeClass('short bad good strong empty');
|
2020-10-10 18:51:07 +02:00
|
|
|
if ( ! pass1 || '' === pass1.trim() ) {
|
2019-09-13 20:30:55 +02:00
|
|
|
$( '#pass-strength-result' ).addClass( 'empty' ).html( ' ' );
|
2012-08-23 02:04:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
General: Remove “whitelist” and “blacklist” in favor of more clear and inclusive language.
“The WordPress open source community cares about diversity. We strive to maintain a welcoming environment where everyone can feel included.”
With this commit, all occurrences of “whitelist” and “blacklist” (with the single exception of the `$new_whitelist_options` global variable) are removed. A new ticket has been opened to explore renaming the `$new_whitelist_options` variable (#50434).
Changing to more specific names or rewording sentences containing these terms not only makes the code more inclusive, but also helps provide clarity. These terms are often ambiguous. What is being blocked or allowed is not always immediately clear. This can make it more difficult for non-native English speakers to read through the codebase.
Words matter. If one contributor feels more welcome because these terms are removed, this was worth the effort.
Props strangerstudios, jorbin, desrosj, joemcgill, timothyblynjacobs, ocean90, ayeshrajans, davidbaumwald, earnjam.
See #48900, #50434.
Fixes #50413.
Built from https://develop.svn.wordpress.org/trunk@48121
git-svn-id: http://core.svn.wordpress.org/trunk@47890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-22 19:26:13 +02:00
|
|
|
strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputDisallowedList(), pass1 );
|
2012-08-23 02:04:18 +02:00
|
|
|
|
|
|
|
switch ( strength ) {
|
2016-07-01 14:45:29 +02:00
|
|
|
case -1:
|
|
|
|
$( '#pass-strength-result' ).addClass( 'bad' ).html( pwsL10n.unknown );
|
|
|
|
break;
|
2012-08-23 02:04:18 +02:00
|
|
|
case 2:
|
2013-11-19 05:40:10 +01:00
|
|
|
$('#pass-strength-result').addClass('bad').html( pwsL10n.bad );
|
2012-08-23 02:04:18 +02:00
|
|
|
break;
|
|
|
|
case 3:
|
2013-11-19 05:40:10 +01:00
|
|
|
$('#pass-strength-result').addClass('good').html( pwsL10n.good );
|
2012-08-23 02:04:18 +02:00
|
|
|
break;
|
|
|
|
case 4:
|
2013-11-19 05:40:10 +01:00
|
|
|
$('#pass-strength-result').addClass('strong').html( pwsL10n.strong );
|
2012-08-23 02:04:18 +02:00
|
|
|
break;
|
|
|
|
case 5:
|
2013-11-19 05:40:10 +01:00
|
|
|
$('#pass-strength-result').addClass('short').html( pwsL10n.mismatch );
|
2012-08-23 02:04:18 +02:00
|
|
|
break;
|
|
|
|
default:
|
2024-02-23 11:38:13 +01:00
|
|
|
$('#pass-strength-result').addClass('short').html( pwsL10n.short );
|
2012-08-23 02:04:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-01 14:45:29 +02:00
|
|
|
function showOrHideWeakPasswordCheckbox() {
|
Administration: Hide password in options/writing.
Hide the password for the "Post via e-mail" settings in writing options. Use the same password hiding mechanisms in use elsewhere in core.
Props mastrup, denis-de-bernardy, ryan, brookedot, wojtek.szkutnik, dd32, sabreuse, sergeybiryukov, costdev, peterwilsoncc, zgrkaralar, clorith, renyot, sabernhardt, boniu91, ironprogrammer, bgoewert.
Fixes #9883.
Built from https://develop.svn.wordpress.org/trunk@55974
git-svn-id: http://core.svn.wordpress.org/trunk@55486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 02:32:21 +02:00
|
|
|
var passStrengthResult = $('#pass-strength-result');
|
|
|
|
|
|
|
|
if ( passStrengthResult.length ) {
|
|
|
|
var passStrength = passStrengthResult[0];
|
|
|
|
|
|
|
|
if ( passStrength.className ) {
|
|
|
|
$pass1.addClass( passStrength.className );
|
|
|
|
if ( $( passStrength ).is( '.short, .bad' ) ) {
|
|
|
|
if ( ! $weakCheckbox.prop( 'checked' ) ) {
|
|
|
|
$submitButtons.prop( 'disabled', true );
|
|
|
|
}
|
|
|
|
$weakRow.show();
|
2019-09-13 20:30:55 +02:00
|
|
|
} else {
|
Administration: Hide password in options/writing.
Hide the password for the "Post via e-mail" settings in writing options. Use the same password hiding mechanisms in use elsewhere in core.
Props mastrup, denis-de-bernardy, ryan, brookedot, wojtek.szkutnik, dd32, sabreuse, sergeybiryukov, costdev, peterwilsoncc, zgrkaralar, clorith, renyot, sabernhardt, boniu91, ironprogrammer, bgoewert.
Fixes #9883.
Built from https://develop.svn.wordpress.org/trunk@55974
git-svn-id: http://core.svn.wordpress.org/trunk@55486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 02:32:21 +02:00
|
|
|
if ( $( passStrength ).is( '.empty' ) ) {
|
|
|
|
$submitButtons.prop( 'disabled', true );
|
|
|
|
$weakCheckbox.prop( 'checked', false );
|
|
|
|
} else {
|
|
|
|
$submitButtons.prop( 'disabled', false );
|
|
|
|
}
|
|
|
|
$weakRow.hide();
|
2019-09-13 20:30:55 +02:00
|
|
|
}
|
2016-07-01 14:45:29 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-18 20:01:03 +01:00
|
|
|
$( function() {
|
2013-11-19 05:40:10 +01:00
|
|
|
var $colorpicker, $stylesheet, user_id, current_user_id,
|
2017-05-12 22:06:42 +02:00
|
|
|
select = $( '#display_name' ),
|
|
|
|
current_name = select.val(),
|
|
|
|
greeting = $( '#wp-admin-bar-my-account' ).find( '.display-name' );
|
2012-08-23 02:04:18 +02:00
|
|
|
|
2019-01-10 03:57:50 +01:00
|
|
|
$( '#pass1' ).val( '' ).on( 'input' + ' pwupdate', check_pass_strength );
|
2012-08-23 02:04:18 +02:00
|
|
|
$('#pass-strength-result').show();
|
2021-01-22 13:32:03 +01:00
|
|
|
$('.color-palette').on( 'click', function() {
|
2012-08-23 02:04:18 +02:00
|
|
|
$(this).siblings('input[name="admin_color"]').prop('checked', true);
|
|
|
|
});
|
|
|
|
|
|
|
|
if ( select.length ) {
|
2021-01-22 13:32:03 +01:00
|
|
|
$('#first_name, #last_name, #nickname').on( 'blur.user_profile', function() {
|
2012-08-23 02:04:18 +02:00
|
|
|
var dub = [],
|
|
|
|
inputs = {
|
|
|
|
display_nickname : $('#nickname').val() || '',
|
|
|
|
display_username : $('#user_login').val() || '',
|
|
|
|
display_firstname : $('#first_name').val() || '',
|
|
|
|
display_lastname : $('#last_name').val() || ''
|
|
|
|
};
|
|
|
|
|
|
|
|
if ( inputs.display_firstname && inputs.display_lastname ) {
|
2013-11-19 05:40:10 +01:00
|
|
|
inputs.display_firstlast = inputs.display_firstname + ' ' + inputs.display_lastname;
|
|
|
|
inputs.display_lastfirst = inputs.display_lastname + ' ' + inputs.display_firstname;
|
2012-08-23 02:04:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$.each( $('option', select), function( i, el ){
|
|
|
|
dub.push( el.value );
|
|
|
|
});
|
|
|
|
|
|
|
|
$.each(inputs, function( id, value ) {
|
2013-11-19 05:40:10 +01:00
|
|
|
if ( ! value ) {
|
2012-08-23 02:04:18 +02:00
|
|
|
return;
|
2013-11-19 05:40:10 +01:00
|
|
|
}
|
2012-08-23 02:04:18 +02:00
|
|
|
|
|
|
|
var val = value.replace(/<\/?[a-z][^>]*>/gi, '');
|
|
|
|
|
2013-11-19 05:40:10 +01:00
|
|
|
if ( inputs[id].length && $.inArray( val, dub ) === -1 ) {
|
2012-08-23 02:04:18 +02:00
|
|
|
dub.push(val);
|
|
|
|
$('<option />', {
|
|
|
|
'text': val
|
|
|
|
}).appendTo( select );
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2017-05-12 22:06:42 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Replaces "Howdy, *" in the admin toolbar whenever the display name dropdown is updated for one's own profile.
|
|
|
|
*/
|
|
|
|
select.on( 'change', function() {
|
|
|
|
if ( user_id !== current_user_id ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-03-18 20:01:03 +01:00
|
|
|
var display_name = this.value.trim() || current_name;
|
2017-05-12 22:06:42 +02:00
|
|
|
|
|
|
|
greeting.text( display_name );
|
|
|
|
} );
|
2012-08-23 02:04:18 +02:00
|
|
|
}
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
Built from https://develop.svn.wordpress.org/trunk@26137
git-svn-id: http://core.svn.wordpress.org/trunk@26048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 20:38:38 +01:00
|
|
|
|
2013-11-19 05:40:10 +01:00
|
|
|
$colorpicker = $( '#color-picker' );
|
|
|
|
$stylesheet = $( '#colors-css' );
|
|
|
|
user_id = $( 'input#user_id' ).val();
|
|
|
|
current_user_id = $( 'input[name="checkuser_id"]' ).val();
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
Built from https://develop.svn.wordpress.org/trunk@26137
git-svn-id: http://core.svn.wordpress.org/trunk@26048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 20:38:38 +01:00
|
|
|
|
2013-12-01 20:50:09 +01:00
|
|
|
$colorpicker.on( 'click.colorpicker', '.color-option', function() {
|
2013-12-04 05:13:11 +01:00
|
|
|
var colors,
|
|
|
|
$this = $(this);
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
Built from https://develop.svn.wordpress.org/trunk@26137
git-svn-id: http://core.svn.wordpress.org/trunk@26048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 20:38:38 +01:00
|
|
|
|
2013-12-01 20:50:09 +01:00
|
|
|
if ( $this.hasClass( 'selected' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
Built from https://develop.svn.wordpress.org/trunk@26137
git-svn-id: http://core.svn.wordpress.org/trunk@26048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 20:38:38 +01:00
|
|
|
|
2013-12-01 20:50:09 +01:00
|
|
|
$this.siblings( '.selected' ).removeClass( 'selected' );
|
|
|
|
$this.addClass( 'selected' ).find( 'input[type="radio"]' ).prop( 'checked', true );
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
Built from https://develop.svn.wordpress.org/trunk@26137
git-svn-id: http://core.svn.wordpress.org/trunk@26048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 20:38:38 +01:00
|
|
|
|
2020-01-29 01:45:18 +01:00
|
|
|
// Set color scheme.
|
2013-11-19 05:40:10 +01:00
|
|
|
if ( user_id === current_user_id ) {
|
2014-02-06 23:16:11 +01:00
|
|
|
// Load the colors stylesheet.
|
|
|
|
// The default color scheme won't have one, so we'll need to create an element.
|
|
|
|
if ( 0 === $stylesheet.length ) {
|
|
|
|
$stylesheet = $( '<link rel="stylesheet" />' ).appendTo( 'head' );
|
|
|
|
}
|
2013-12-01 20:50:09 +01:00
|
|
|
$stylesheet.attr( 'href', $this.children( '.css_url' ).val() );
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
Built from https://develop.svn.wordpress.org/trunk@26137
git-svn-id: http://core.svn.wordpress.org/trunk@26048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 20:38:38 +01:00
|
|
|
|
2020-01-29 01:45:18 +01:00
|
|
|
// Repaint icons.
|
2013-12-05 23:01:10 +01:00
|
|
|
if ( typeof wp !== 'undefined' && wp.svgPainter ) {
|
2013-12-04 05:13:11 +01:00
|
|
|
try {
|
2021-02-23 20:45:04 +01:00
|
|
|
colors = JSON.parse( $this.children( '.icon_colors' ).val() );
|
2013-12-04 05:13:11 +01:00
|
|
|
} catch ( error ) {}
|
|
|
|
|
|
|
|
if ( colors ) {
|
2013-12-05 23:01:10 +01:00
|
|
|
wp.svgPainter.setColors( colors );
|
|
|
|
wp.svgPainter.paint();
|
2013-12-04 05:13:11 +01:00
|
|
|
}
|
2013-12-01 20:50:09 +01:00
|
|
|
}
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
Built from https://develop.svn.wordpress.org/trunk@26137
git-svn-id: http://core.svn.wordpress.org/trunk@26048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 20:38:38 +01:00
|
|
|
|
2020-01-29 01:45:18 +01:00
|
|
|
// Update user option.
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
Built from https://develop.svn.wordpress.org/trunk@26137
git-svn-id: http://core.svn.wordpress.org/trunk@26048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 20:38:38 +01:00
|
|
|
$.post( ajaxurl, {
|
2013-12-02 20:45:10 +01:00
|
|
|
action: 'save-user-color-scheme',
|
|
|
|
color_scheme: $this.children( 'input[name="admin_color"]' ).val(),
|
2013-12-07 08:46:21 +01:00
|
|
|
nonce: $('#color-nonce').val()
|
2015-02-10 03:23:28 +01:00
|
|
|
}).done( function( response ) {
|
|
|
|
if ( response.success ) {
|
|
|
|
$( 'body' ).removeClass( response.data.previousScheme ).addClass( response.data.currentScheme );
|
|
|
|
}
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
Built from https://develop.svn.wordpress.org/trunk@26137
git-svn-id: http://core.svn.wordpress.org/trunk@26048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 20:38:38 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2015-07-27 23:25:25 +02:00
|
|
|
|
|
|
|
bindPasswordForm();
|
2021-08-02 18:48:57 +02:00
|
|
|
bindPasswordResetLink();
|
2024-05-12 20:45:14 +02:00
|
|
|
$submitButtons.on( 'click', function() {
|
|
|
|
isSubmitting = true;
|
|
|
|
});
|
|
|
|
|
|
|
|
$form = $( '#your-profile, #createuser' );
|
|
|
|
originalFormContent = $form.serialize();
|
2012-08-23 02:04:18 +02:00
|
|
|
});
|
|
|
|
|
2014-11-13 16:54:20 +01:00
|
|
|
$( '#destroy-sessions' ).on( 'click', function( e ) {
|
2014-11-13 16:21:21 +01:00
|
|
|
var $this = $(this);
|
|
|
|
|
2014-12-16 10:15:23 +01:00
|
|
|
wp.ajax.post( 'destroy-sessions', {
|
|
|
|
nonce: $( '#_wpnonce' ).val(),
|
|
|
|
user_id: $( '#user_id' ).val()
|
|
|
|
}).done( function( response ) {
|
|
|
|
$this.prop( 'disabled', true );
|
|
|
|
$this.siblings( '.notice' ).remove();
|
2024-06-21 20:17:14 +02:00
|
|
|
$this.before( '<div class="notice notice-success inline" role="alert"><p>' + response.message + '</p></div>' );
|
2014-12-16 10:15:23 +01:00
|
|
|
}).fail( function( response ) {
|
|
|
|
$this.siblings( '.notice' ).remove();
|
2024-06-21 20:17:14 +02:00
|
|
|
$this.before( '<div class="notice notice-error inline" role="alert"><p>' + response.message + '</p></div>' );
|
2014-12-16 10:15:23 +01:00
|
|
|
});
|
2014-11-13 16:21:21 +01:00
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
});
|
|
|
|
|
2015-07-27 23:25:25 +02:00
|
|
|
window.generatePassword = generatePassword;
|
|
|
|
|
2020-10-20 20:27:13 +02:00
|
|
|
// Warn the user if password was generated but not saved.
|
2015-07-27 23:25:25 +02:00
|
|
|
$( window ).on( 'beforeunload', function () {
|
|
|
|
if ( true === updateLock ) {
|
2020-07-01 22:38:01 +02:00
|
|
|
return __( 'Your new password has not been saved.' );
|
2015-07-27 23:25:25 +02:00
|
|
|
}
|
2024-05-12 20:45:14 +02:00
|
|
|
if ( originalFormContent !== $form.serialize() && ! isSubmitting ) {
|
2024-05-14 18:14:11 +02:00
|
|
|
return __( 'The changes you made will be lost if you navigate away from this page.' );
|
2024-05-12 20:45:14 +02:00
|
|
|
}
|
|
|
|
});
|
2015-07-27 23:25:25 +02:00
|
|
|
|
Login and Registration: Improve the UX of the Reset Password screen.
Previously, it was unclear that the displayed password is only being suggested and should be saved by clicking the Reset Password button.
This adds separate Generate Password and Save Password buttons, for clarity.
Props xkon, estelaris, jaymanpandya, hedgefield, audrasjb, erichmond, magicroundabout, lukecavanagh, knutsp, tinodidriksen, nico_martin, markhowellsmead, kara.mcnair, e_baker, pixelverbieger, souri_wpaustria, megabyterose, poena, whyisjake.
Fixes #39638.
Built from https://develop.svn.wordpress.org/trunk@50153
git-svn-id: http://core.svn.wordpress.org/trunk@49832 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 19:13:04 +01:00
|
|
|
/*
|
|
|
|
* We need to generate a password as soon as the Reset Password page is loaded,
|
|
|
|
* to avoid double clicking the button to retrieve the first generated password.
|
|
|
|
* See ticket #39638.
|
|
|
|
*/
|
2021-03-18 20:01:03 +01:00
|
|
|
$( function() {
|
Login and Registration: Improve the UX of the Reset Password screen.
Previously, it was unclear that the displayed password is only being suggested and should be saved by clicking the Reset Password button.
This adds separate Generate Password and Save Password buttons, for clarity.
Props xkon, estelaris, jaymanpandya, hedgefield, audrasjb, erichmond, magicroundabout, lukecavanagh, knutsp, tinodidriksen, nico_martin, markhowellsmead, kara.mcnair, e_baker, pixelverbieger, souri_wpaustria, megabyterose, poena, whyisjake.
Fixes #39638.
Built from https://develop.svn.wordpress.org/trunk@50153
git-svn-id: http://core.svn.wordpress.org/trunk@49832 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 19:13:04 +01:00
|
|
|
if ( $( '.reset-pass-submit' ).length ) {
|
|
|
|
$( '.reset-pass-submit button.wp-generate-pw' ).trigger( 'click' );
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2012-08-23 02:04:18 +02:00
|
|
|
})(jQuery);
|