2018-06-28 04:30:15 +02:00
|
|
|
/**
|
|
|
|
* @output wp-admin/js/user-profile.js
|
|
|
|
*/
|
|
|
|
|
2020-07-01 22:38:01 +02:00
|
|
|
/* global ajaxurl, pwsL10n */
|
2015-07-27 23:25:25 +02:00
|
|
|
(function($) {
|
|
|
|
var updateLock = 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,
|
2019-01-10 03:57:50 +01:00
|
|
|
currentPass;
|
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;
|
|
|
|
} else if ( ! $pass1.val() ) {
|
|
|
|
// zxcvbn loaded before user entered 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();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// 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
|
|
|
|
|
|
|
if ( 1 !== parseInt( $toggleButton.data( 'start-masked' ), 10 ) ) {
|
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 {
|
|
|
|
$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' ) );
|
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
|
|
|
|
|
|
|
$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() {
|
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
|
|
|
|
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.focus();
|
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
|
|
|
if ( ! _.isUndefined( $pass1[0].setSelectionRange ) ) {
|
|
|
|
$pass1[0].setSelectionRange( 0, 100 );
|
2015-07-01 16:48:24 +02:00
|
|
|
}
|
2015-07-27 23:25:25 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function bindPasswordForm() {
|
|
|
|
var $passwordWrapper,
|
|
|
|
$generateButton,
|
|
|
|
$cancelButton;
|
|
|
|
|
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
|
|
|
$pass1Row = $( '.user-pass1-wrap, .user-pass-wrap' );
|
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' );
|
|
|
|
$weakCheckbox.change( function() {
|
|
|
|
$submitButtons.prop( 'disabled', ! $weakCheckbox.prop( 'checked' ) );
|
2015-07-01 16:48:24 +02:00
|
|
|
} );
|
|
|
|
|
2015-07-27 23:25:25 +02:00
|
|
|
$pass1 = $('#pass1');
|
|
|
|
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
|
|
|
}
|
|
|
|
|
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
|
|
|
if ( $generateButton.length ) {
|
|
|
|
$passwordWrapper.hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
$generateButton.show();
|
2015-07-27 23:25:25 +02:00
|
|
|
$generateButton.on( 'click', function () {
|
|
|
|
updateLock = true;
|
|
|
|
|
|
|
|
$generateButton.hide();
|
|
|
|
$passwordWrapper.show();
|
|
|
|
|
2015-11-10 21:41:26 +01:00
|
|
|
// Enable the inputs when showing.
|
|
|
|
$pass1.attr( 'disabled', false );
|
|
|
|
$pass2.attr( 'disabled', false );
|
|
|
|
|
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 ( $pass1.val().length === 0 ) {
|
2015-07-29 06:30:24 +02:00
|
|
|
generatePassword();
|
|
|
|
}
|
2015-07-27 23:25:25 +02:00
|
|
|
} );
|
2015-07-22 18:56:27 +02:00
|
|
|
|
2015-07-27 23:25:25 +02:00
|
|
|
$cancelButton = $pass1Row.find( 'button.wp-cancel-pw' );
|
|
|
|
$cancelButton.on( 'click', function () {
|
|
|
|
updateLock = false;
|
2015-07-01 16:48:24 +02:00
|
|
|
|
2015-09-18 22:14:24 +02:00
|
|
|
// Clear any entered password.
|
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.val( '' );
|
2015-09-18 22:14:24 +02:00
|
|
|
|
|
|
|
// Generate a new password.
|
|
|
|
wp.ajax.post( 'generate-password' )
|
|
|
|
.done( function( data ) {
|
|
|
|
$pass1.data( 'pw', data );
|
|
|
|
} );
|
|
|
|
|
2019-03-14 00:37:57 +01:00
|
|
|
$generateButton.show().focus();
|
2015-07-27 23:25:25 +02:00
|
|
|
$passwordWrapper.hide();
|
2015-08-27 02:11:21 +02:00
|
|
|
|
2015-12-11 22:54:27 +01:00
|
|
|
$weakRow.hide( 0, function () {
|
|
|
|
$weakCheckbox.removeProp( 'checked' );
|
|
|
|
} );
|
|
|
|
|
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 );
|
|
|
|
|
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
|
|
|
|
2016-09-01 14:24:29 +02:00
|
|
|
if ( $pass1Row.closest( 'form' ).is( '#your-profile' ) ) {
|
2020-01-29 01:45:18 +01:00
|
|
|
// Clear password field to prevent update.
|
2016-09-01 14:24:29 +02:00
|
|
|
$pass1.val( '' ).trigger( 'pwupdate' );
|
|
|
|
$submitButtons.prop( 'disabled', 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');
|
2012-08-23 02:04:18 +02:00
|
|
|
if ( ! pass1 ) {
|
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:
|
|
|
|
$('#pass-strength-result').addClass('short').html( pwsL10n['short'] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-01 14:45:29 +02:00
|
|
|
function showOrHideWeakPasswordCheckbox() {
|
|
|
|
var passStrength = $('#pass-strength-result')[0];
|
|
|
|
|
|
|
|
if ( passStrength.className ) {
|
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.addClass( passStrength.className );
|
2017-09-21 23:29:48 +02:00
|
|
|
if ( $( passStrength ).is( '.short, .bad' ) ) {
|
2016-07-01 14:45:29 +02:00
|
|
|
if ( ! $weakCheckbox.prop( 'checked' ) ) {
|
|
|
|
$submitButtons.prop( 'disabled', true );
|
|
|
|
}
|
|
|
|
$weakRow.show();
|
|
|
|
} else {
|
2019-09-13 20:30:55 +02:00
|
|
|
if ( $( passStrength ).is( '.empty' ) ) {
|
|
|
|
$submitButtons.prop( 'disabled', true );
|
|
|
|
$weakCheckbox.prop( 'checked', false );
|
|
|
|
} else {
|
|
|
|
$submitButtons.prop( 'disabled', false );
|
|
|
|
}
|
2016-07-01 14:45:29 +02:00
|
|
|
$weakRow.hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-23 02:04:18 +02:00
|
|
|
$(document).ready( 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();
|
|
|
|
$('.color-palette').click( function() {
|
|
|
|
$(this).siblings('input[name="admin_color"]').prop('checked', true);
|
|
|
|
});
|
|
|
|
|
|
|
|
if ( select.length ) {
|
|
|
|
$('#first_name, #last_name, #nickname').bind( 'blur.user_profile', function() {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
var display_name = $.trim( this.value ) || current_name;
|
|
|
|
|
|
|
|
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 {
|
|
|
|
colors = $.parseJSON( $this.children( '.icon_colors' ).val() );
|
|
|
|
} 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();
|
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();
|
|
|
|
$this.before( '<div class="notice notice-success inline"><p>' + response.message + '</p></div>' );
|
|
|
|
}).fail( function( response ) {
|
|
|
|
$this.siblings( '.notice' ).remove();
|
|
|
|
$this.before( '<div class="notice notice-error inline"><p>' + response.message + '</p></div>' );
|
|
|
|
});
|
2014-11-13 16:21:21 +01:00
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
});
|
|
|
|
|
2015-07-27 23:25:25 +02:00
|
|
|
window.generatePassword = generatePassword;
|
|
|
|
|
|
|
|
/* Warn the user if password was generated but not saved */
|
|
|
|
$( 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
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
2012-08-23 02:04:18 +02:00
|
|
|
})(jQuery);
|