diff --git a/core/modules/user/user.js b/core/modules/user/user.js
index 82d165c..5024d8e 100644
--- a/core/modules/user/user.js
+++ b/core/modules/user/user.js
@@ -81,6 +81,39 @@
}
};
+ Drupal.behaviors.showPassword = {
+ attach: function (context) {
+ // Create the checkbox.
+ var showPassword = $('');
+ // Add click handler to checkboxes.
+ $(':checkbox', showPassword).click(function () {
+ var orig;
+ var copy;
+ var wrap;
+ if ($(this).is(':checked')) {
+ // Copy original field and convert it to a simple textfield.
+ orig = $(this).parent().parent().find(':password');
+ copy = $('');
+ }
+ else {
+ // Copy original field and convert it to a password field.
+ orig = $(this).parent().parent().find('.show-password');
+ copy = $('');
+ }
+ // Replace currently displayed field with the modified copy and re-assign
+ // all attributes. Thanks to IE we have to go this way.
+ $(copy).attr('id', $(orig).attr('id'));
+ $(copy).attr('class', $(orig).attr('class'));
+ $(copy).attr('size', $(orig).attr('size'));
+ $(copy).attr('maxlength', $(orig).attr('maxlength'));
+ $(copy).attr('name', $(orig).attr('name'));
+ $(orig).replaceWith($(copy).toggleClass('show-password').val($(orig).val()));
+ });
+ // Add checkbox to all password field on the current page.
+ showPassword.insertAfter($(':password', context));
+ }
+ };
+
/**
* Evaluate the strength of a user's password.
*