If you look at the system_element_info the password confirm element looks like this:

<?php
$types['password_confirm'] = array(
    '#input' => TRUE, 
    '#process' => array('form_process_password_confirm', 'user_form_process_password_confirm'), 
    '#theme_wrappers' => array('form_element'),
  );
?>

I completely understand why form_process_password_confirm is there, but user_form_process_password_confirm probably doesn't belong there.

If anything this should be added, on the user_account_form callback.

This assumes the password_confirm element is always being used on the user register.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ericduran’s picture

Issue tags: +Novice, +d8dx

Tagging

pgrond’s picture

FileSize
536 bytes

Made a patch for the removal of user_form_process_password_confirm

pgrond’s picture

Status: Active » Needs review
ericduran’s picture

Status: Needs review » Needs work

@pgrond, awesome.

But the user_form_process_password_confirm still needs to be added when on the user form.

pgrond’s picture

FileSize
1.01 KB

Ah ok. Something like this? Not sure if you can just use #process => array('user_form_process_password_confirm') in the element declaration. I guess this would override the reference to 'form_process_password_confirm', so I'm checking if the element exists and add the function to the #process array.

pgrond’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 1226044-5008820.patch, failed testing.

rbayliss’s picture

Status: Needs work » Needs review
FileSize
2.11 KB

You're right that adding a #process handler in the form declaration overrides the system level #process handler, but this will happen regardless of where the handler is added, so long as it is inside the user_account_form. How about switching user_form_process_password_confirm to a #pre_render handler, since it is adding the script for display purposes anyway.

ericduran’s picture

@rbayliss yea, I think this is better.

roborn’s picture

+++ b/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -977,6 +977,7 @@ function user_account_form(&$form, &$form_state) {

This form now uses the new entity form controller.

I've tried the patch and everything looks good.

enhdless’s picture

Issue summary: View changes
Status: Needs review » Needs work

Patch is in need of rerolling.

martin107’s picture

Status: Needs work » Needs review
FileSize
2.51 KB

ReRoll

martin107’s picture

Issue tags: -Novice
martin107’s picture

Status: Needs review » Reviewed & tested by the community
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.x, thanks!

David_Rothstein’s picture

Title: The password_confirm element should not be aware of the user_form_process_password_confirm process » (followup: password strength indicator missing in installer) The password_confirm element should not be aware of the user_form_process_password_confirm process
Priority: Normal » Critical
Status: Fixed » Needs work

This removed the client-side password-match validation and password strength indicator from the installer (which I consider critical because the user 1 account is the most important one to have a strong password).

I also don't think this change makes sense. Why wouldn't we want these things on all password confirm elements by default??? If someone really wants to remove it on a particular form, they can remove it there, but it's beneficial for security and usability (as well as developer experience) to have it there by default without the burden of developers having to remember to add it every time.

I would suggest rolling this back, then maybe following up by simply moving the code out of the User module and into form.inc (although keeping it #pre_render rather than #process seems reasonable), or alternatively having User module add it via hook_element_info_alter() (to address the original issue). The code isn't particularly specific to the User module at all.

catch’s picture

Title: (followup: password strength indicator missing in installer) The password_confirm element should not be aware of the user_form_process_password_confirm process » The password_confirm element should not be aware of the user_form_process_password_confirm process
Priority: Critical » Normal
Issue tags: +Needs tests

Don't have a strong opinion on moving that code to form.inc vs. keeping it separate, however reverted the patch due to the regression regardless.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

  • catch committed dc2e472 on 8.3.x
    Issue #1226044 by pgrond, martin107, roborn, rbayliss: The...
  • catch committed 4418321 on 8.3.x
    Revert "Issue #1226044 by pgrond, martin107, roborn, rbayliss: The...

  • catch committed dc2e472 on 8.3.x
    Issue #1226044 by pgrond, martin107, roborn, rbayliss: The...
  • catch committed 4418321 on 8.3.x
    Revert "Issue #1226044 by pgrond, martin107, roborn, rbayliss: The...

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

  • catch committed dc2e472 on 8.4.x
    Issue #1226044 by pgrond, martin107, roborn, rbayliss: The...
  • catch committed 4418321 on 8.4.x
    Revert "Issue #1226044 by pgrond, martin107, roborn, rbayliss: The...

  • catch committed dc2e472 on 8.4.x
    Issue #1226044 by pgrond, martin107, roborn, rbayliss: The...
  • catch committed 4418321 on 8.4.x
    Revert "Issue #1226044 by pgrond, martin107, roborn, rbayliss: The...

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

catch’s picture

Status: Needs work » Closed (outdated)

This is no longer the case - PasswordConfirm (in core/lib) doesn't reference user module at all.