From dc2e4720df835a8d09e10eb22cb5b96747740c20 Mon Sep 17 00:00:00 2001
From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org>
Date: Fri, 3 Jan 2014 17:52:19 +0000
Subject: [PATCH] Issue #1226044 by pgrond, martin107, roborn, rbayliss: The
 password_confirm element should not be aware of the
 user_form_process_password_confirm process.

---
 core/modules/system/system.module                        | 2 +-
 .../user/lib/Drupal/user/AccountFormController.php       | 2 ++
 core/modules/user/user.module                            | 9 +++------
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index d922cd97f859..c68117b55b60 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -419,7 +419,7 @@ function system_element_info() {
   );
   $types['password_confirm'] = array(
     '#input' => TRUE,
-    '#process' => array('form_process_password_confirm', 'user_form_process_password_confirm'),
+    '#process' => array('form_process_password_confirm'),
     '#theme_wrappers' => array('form_element'),
   );
   $types['textarea'] = array(
diff --git a/core/modules/user/lib/Drupal/user/AccountFormController.php b/core/modules/user/lib/Drupal/user/AccountFormController.php
index 4983b0f0bedd..eca2eb29d48f 100644
--- a/core/modules/user/lib/Drupal/user/AccountFormController.php
+++ b/core/modules/user/lib/Drupal/user/AccountFormController.php
@@ -99,6 +99,7 @@ public function form(array $form, array &$form_state) {
         '#type' => 'password_confirm',
         '#size' => 25,
         '#description' => $this->t('To change the current user password, enter the new password in both fields.'),
+        '#pre_render' => array('user_form_pre_render_password_confirm'),
       );
 
       // To skip the current password field, the user must have logged in via a
@@ -146,6 +147,7 @@ public function form(array $form, array &$form_state) {
         '#type' => 'password_confirm',
         '#size' => 25,
         '#description' => $this->t('Provide a password for the new account in both fields.'),
+        '#pre_render' => array('user_form_pre_render_password_confirm'),
         '#required' => TRUE,
       );
     }
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index f6a30cbde5da..f551063c5173 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -1699,13 +1699,10 @@ function _user_mail_notify($op, $account, $langcode = NULL) {
 /**
  * Form element process handler for client-side password validation.
  *
- * This #process handler is automatically invoked for 'password_confirm' form
- * elements to add the JavaScript and string translations for dynamic password
- * validation.
- *
- * @see system_element_info()
+ * This #pre_render handler is added to the user registration form to add the
+ * JavaScript and string translations for dynamic password validation.
  */
-function user_form_process_password_confirm($element) {
+function user_form_pre_render_password_confirm($element) {
   $password_settings = array(
     'confirmTitle' => t('Passwords match:'),
     'confirmSuccess' => t('yes'),
-- 
GitLab