diff --git a/core/modules/user/user.js b/core/modules/user/user.js
index 45f554c..490d14d 100644
--- a/core/modules/user/user.js
+++ b/core/modules/user/user.js
@@ -1,4 +1,4 @@
-(function ($) {
+(function ($, Drupal, drupalSettings) {
 
   "use strict";
 
@@ -8,37 +8,43 @@
    */
   Drupal.behaviors.password = {
     attach: function (context, settings) {
-      var translate = settings.password;
-      $(context).find('input.password-field').once('password').each(function () {
-        var passwordInput = $(this);
-        var innerWrapper = $(this).parent();
-        var outerWrapper = $(this).parent().parent();
-        var passwordDescription;
+      var $passwordInput = $(context).find('input.password-field').once('password');
+
+      if ($passwordInput.length) {
+        var translate = settings.password;
+
+        var $passwordInputParent = $passwordInput.parent();
+        var $passwordInputParentWrapper = $passwordInputParent.parent();
 
         // Add identifying class to password element parent.
-        innerWrapper.addClass('password-parent');
+        $passwordInputParent.addClass('password-parent');
 
         // Add the password confirmation layer.
-        outerWrapper.find('input.password-confirm').parent().append('<div class="password-confirm-match">' + translate.confirmTitle + ' <span></span></div>').addClass('confirm-parent');
-        var confirmInput = outerWrapper.find('input.password-confirm');
-        var confirmResult = outerWrapper.find('div.password-confirm-match');
-        var confirmChild = confirmResult.find('span');
+        $passwordInputParentWrapper
+          .find('input.password-confirm')
+          .parent()
+          .append('<div class="password-confirm">' + translate.confirmTitle + ' <span></span></div>')
+          .addClass('confirm-parent');
+
+        var $confirmInput = $passwordInputParentWrapper.find('input.password-confirm');
+        var $confirmResult = $passwordInputParentWrapper.find('div.password-confirm');
+        var $confirmChild = $confirmResult.find('span');
 
         // If the password strength indicator is enabled, add its markup.
         if (settings.password.showStrengthIndicator) {
           var passwordMeter = '<div class="password-strength"><div class="password-strength__meter"><div class="password-strength__indicator"></div></div><div class="password-strength__title">' + translate.strengthTitle + ' </div><div class="password-strength__text" aria-live="assertive"></div></div>';
-          confirmInput.parent().after('<div class="password-suggestions description"></div>');
-          innerWrapper.append(passwordMeter);
-          passwordDescription = outerWrapper.find('div.password-suggestions').hide();
+          $confirmInput.parent().after('<div class="password-suggestions description"></div>');
+          $passwordInputParent.append(passwordMeter);
+          var $passwordSuggestions = $passwordInputParentWrapper.find('div.password-suggestions').hide();
         }
 
         // Check that password and confirmation inputs match.
         var passwordCheckMatch = function (confirmInputVal) {
-          var success = passwordInput.val() === confirmInputVal;
+          var success = $passwordInput.val() === confirmInputVal;
           var confirmClass = success ? 'ok' : 'error';
 
           // Fill in the success message and set the class accordingly.
-          confirmChild.html(translate['confirm' + (success ? 'Success' : 'Failure')])
+          $confirmChild.html(translate['confirm' + (success ? 'Success' : 'Failure')])
             .removeClass('ok error').addClass(confirmClass);
         };
 
@@ -46,40 +52,40 @@
         var passwordCheck = function () {
           if (settings.password.showStrengthIndicator) {
             // Evaluate the password strength.
-            var result = Drupal.evaluatePasswordStrength(passwordInput.val(), settings.password);
+            var result = Drupal.evaluatePasswordStrength($passwordInput.val(), settings.password);
 
             // Update the suggestions for how to improve the password.
-            if (passwordDescription.html() !== result.message) {
-              passwordDescription.html(result.message);
+            if ($passwordSuggestions.html() !== result.message) {
+              $passwordSuggestions.html(result.message);
             }
 
             // Only show the description box if a weakness exists in the password.
-            passwordDescription.toggle(result.strength !== 100);
+            $passwordSuggestions.toggle(result.strength !== 100);
 
             // Adjust the length of the strength indicator.
-            innerWrapper.find('.password-strength__indicator')
+            $passwordInputParent.find('.indicator')
               .css('width', result.strength + '%')
               .removeClass('is-weak is-fair is-good is-strong')
               .addClass(result.indicatorClass);
 
             // Update the strength indication text.
-            innerWrapper.find('.password-strength__text').html(result.indicatorText);
+            $passwordInputParent.find('.password-strength-text').html(result.indicatorText);
           }
 
           // Check the value in the confirm input and show results.
-          if (confirmInput.val()) {
-            passwordCheckMatch(confirmInput.val());
-            confirmResult.css({visibility: 'visible'});
+          if ($confirmInput.val()) {
+            passwordCheckMatch($confirmInput.val());
+            $confirmResult.css({ visibility: 'visible' });
           }
           else {
-            confirmResult.css({visibility: 'hidden'});
+            $confirmResult.css({ visibility: 'hidden' });
           }
         };
 
         // Monitor input events.
-        passwordInput.on('input', passwordCheck);
-        confirmInput.on('input', passwordCheck);
-      });
+        $passwordInput.on('input', passwordCheck);
+        $confirmInput.on('input', passwordCheck);
+      }
     }
   };
 
@@ -91,15 +97,15 @@
   Drupal.evaluatePasswordStrength = function (password, translate) {
     var indicatorText, indicatorClass, weaknesses = 0, strength = 100, msg = [];
 
-    var hasLowercase = /[a-z]+/.test(password);
-    var hasUppercase = /[A-Z]+/.test(password);
-    var hasNumbers = /[0-9]+/.test(password);
-    var hasPunctuation = /[^a-zA-Z0-9]+/.test(password);
+    var hasLowercase = /[a-z]/.test(password);
+    var hasUppercase = /[A-Z]/.test(password);
+    var hasNumbers = /[0-9]/.test(password);
+    var hasPunctuation = /[^a-zA-Z0-9]/.test(password);
 
     // If there is a username edit box on the page, compare password to that, otherwise
     // use value from the database.
-    var usernameBox = $('input.username');
-    var username = (usernameBox.length > 0) ? usernameBox.val() : translate.username;
+    var $usernameInput = $('input.username');
+    var username = ($usernameInput.length > 0) ? $usernameInput.val() : translate.username;
 
     // Lose 5 points for every character less than 6, plus a 30 point penalty.
     if (password.length < 6) {
@@ -171,8 +177,14 @@
 
     // Assemble the final message.
     msg = translate.hasWeaknesses + '<ul><li>' + msg.join('</li><li>') + '</li></ul>';
-    return {strength: strength, message: msg, indicatorText: indicatorText, indicatorClass: indicatorClass};
+
+    return {
+      strength: strength,
+      message: msg,
+      indicatorText: indicatorText,
+      indicatorColor: indicatorColor
+    };
 
   };
 
-})(jQuery);
+})(jQuery, Drupal, drupalSettings);
diff --git a/core/modules/user/user.permissions.js b/core/modules/user/user.permissions.js
index d47ee9a..068e2aa 100644
--- a/core/modules/user/user.permissions.js
+++ b/core/modules/user/user.permissions.js
@@ -8,16 +8,16 @@
   Drupal.behaviors.permissions = {
     attach: function (context) {
       var self = this;
-      $('table#permissions').once('permissions').each(function () {
+      var $table = $('#permissions').once('permissions');
+if($table.length) {
         // On a site with many roles and permissions, this behavior initially has
         // to perform thousands of DOM manipulations to inject checkboxes and hide
         // them. By detaching the table from the DOM, all operations can be
         // performed without triggering internal layout and re-rendering processes
         // in the browser.
-        var $table = $(this);
-        var $ancestor, method;
-        if ($table.prev().length) {
-          $ancestor = $table.prev();
+        var method;
+        var $ancestor = $table.prev();
+        if ($ancestor.length) {
           method = 'after';
         }
         else {
@@ -35,9 +35,11 @@
           .attr('title', Drupal.t("This permission is inherited from the authenticated user role."))
           .hide();
 
-        $table.find('input[type=checkbox]').not('.rid-anonymous, .rid-authenticated').addClass('real-checkbox').each(function () {
-          $dummy.clone().insertAfter(this);
-        });
+        $table
+          .find('input[type="checkbox"]')
+          .not('.rid-anonymous, .rid-authenticated')
+          .addClass('real-checkbox')
+          .after($dummy);
 
         // Initialize the authenticated user checkbox.
         $table.find('input[type=checkbox].rid-authenticated')
@@ -48,7 +50,7 @@
 
         // Re-insert the table into the DOM.
         $ancestor[method]($table);
-      });
+      }
     },
 
     /**
