reverted: --- b/core/lib/Drupal/Core/Render/Element/PasswordReveal.php +++ /dev/null @@ -1,50 +0,0 @@ - 'password_reveal', - * '#title' => t('Password'), - * '#size' => 25, - * ); - * @endcode - * - * @see \Drupal\Core\Render\Element\Password - * - * @FormElement("password_reveal") - */ -class PasswordReveal extends Password { - - /** - * {@inheritdoc} - */ - public function getInfo() { - $info = parent::getInfo(); - $info['#process'][] = [static::class, 'processPasswordReveal']; - - return $info; - } - - /** - * Adds the attributes needed to add password strength and the reveal button. - */ - public static function processPasswordReveal(&$element, FormStateInterface $form_state, &$complete_form) { - $element['#attached']['library'][] = 'core/drupal.revealpass'; - $element['#attributes']['class'][] = 'password-field'; - $element['#attributes']['class'][] = 'js-password-field'; - $element['#attributes']['data-drupal-revealpass'] = TRUE; - $element['#attributes']['data-drupal-password-strength'] = TRUE; - - return $element; - } - -} reverted: --- b/core/misc/revealpass.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @file - * Creates a reveal password link on password inputs. - */ - -(function ($, Drupal) { - - 'use strict'; - - var showPass = Drupal.t('Show password'); - var hidePass = Drupal.t('Hide password'); - - /** - * Reveal click handle that either shows or hides the password. - * - * @param {jQuery.Event} event - * The jQuery event. - */ - function revealClickHandle(event) { - var $pass = $(event.data.password); - var $button = $(event.target); - - if ($pass.attr('type') === 'password') { - $pass.attr('type', 'text'); - $button.text(hidePass); - } - else { - $pass.attr('type', 'password'); - $button.text(showPass); - } - } - - /** - * Create reveal button and bind event. - * - * @param {number} index - * The index in the loop, as provided by `jQuery.each` - * @param {HTMLElement} element - * The password input form element. - */ - function revealLink(index, element) { - var $trigger = $(''); - - $trigger.on('click', {password: element}, revealClickHandle); - $trigger.insertAfter(element); - } - - /** - * Initialize reveal links. - * - * @type {Drupal~behavior} - */ - Drupal.behaviors.revealPass = { - attach: function (context) { - $(context).find('input[type=password][data-drupal-revealpass]') - .once('revealpass') - .each(revealLink); - } - }; - -})(jQuery, Drupal); reverted: --- b/core/modules/system/tests/modules/form_test/src/Form/FormTestPasswordReveal.php +++ /dev/null @@ -1,43 +0,0 @@ - $this->t('Password One'), - '#type' => 'password_reveal', - '#size' => 25, - ]; - $form['password_two'] = [ - '#title' => $this->t('Password Two'), - '#type' => 'password_reveal', - '#size' => 25, - ]; - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - } - -} reverted: --- b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/PasswordRevealTest.php +++ /dev/null @@ -1,54 +0,0 @@ -drupalGet('/form-test/password-reveal'); - $page = $this->getSession()->getPage(); - - $toogle_password_one_link = $page->find('css', '.toggle-password'); - $password_one_field = $page->findById('edit-password-one'); - $password_two_field = $page->findById('edit-password-two'); - - /* Initial state: before the show password link is clicked. */ - - // Test that both password fields type is password. - $this->assertEquals($password_one_field->getAttribute('type'), 'password'); - $this->assertEquals($password_two_field->getAttribute('type'), 'password'); - - // Change state: click the "show password" of password one link. - $toogle_password_one_link->click(); - - // Test that the password one field type is now text. - $this->assertEquals($password_one_field->getAttribute('type'), 'text'); - // Test that the password two field type is still password. - $this->assertEquals($password_two_field->getAttribute('type'), 'password'); - - // Change state: click the "hide password" link. - $toogle_password_one_link->click(); - - // Test that the password field type is password. - $this->assertEquals($password_one_field->getAttribute('type'), 'password'); - // Test that the password two field type is still password. - $this->assertEquals($password_two_field->getAttribute('type'), 'password'); - - } - -} reverted: --- b/core/tests/Drupal/Tests/Core/Render/Element/PasswordRevealTest.php +++ /dev/null @@ -1,40 +0,0 @@ -prophesize(FormStateInterface::class)->reveal(); - $this->assertSame($expected, PasswordReveal::valueCallback($element, $input, $form_state)); - } - - /** - * Data provider for testValueCallback(). - */ - public function providerTestValueCallback() { - $data = []; - $data[] = [NULL, FALSE]; - $data[] = [NULL, NULL]; - $data[] = ['', ['test']]; - $data[] = ['test', 'test']; - $data[] = ['123', 123]; - - return $data; - } - -} only in patch2: unchanged: --- a/vendor/drupal/coder +++ b/vendor/drupal/coder @@ -1 +1 @@ -Subproject commit 984c54a7b1e8f27ff1c32348df69712afd86b17f +Subproject commit 984c54a7b1e8f27ff1c32348df69712afd86b17f-dirty