Problem/Motivation

Provide two e-mail fields (e-mail and 'confirm e-mail') to ensure accuracy on user registration. The LoginToboggan module does this.

Proposed resolution

Abstracting this to a new property name "#confirm" that can be applied to any Form API element.

Remaining tasks

Review the patch in comment #32.

User interface changes

  • New option to enable 'E-mail address confirmation field' in the user accounts settings page (in the 'registration/cancellation' fieldset).
  • If that option is enabled, an additional field on the user registration form (user/register) for 'Confirm e-mail address'.

API changes

  • Addition of #confirm property to the Form API.
  • TBD. Potential removal of the Form API element type 'password_confirm'.

Original feature request by birdmanx35

Part of a series of reforms for the login system, this patch would ideally provide two e-mail fields to ensure accuracy on registration, a feature that has previously been provided by the LoginToboggan module.

The login functionality applies to all Drupal installs, and this usability feature seems to me to be applicable to all Drupal installs and therefore the 6.x-dev core.

NOTE: I have no coding skills whatsoever, however, I hope I can contribute my ideas and hopes to Drupal.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Pasqualle’s picture

Version: 6.x-dev » 7.x-dev
Priority: Minor » Normal
bsherwood’s picture

Category: feature » bug

+1 Subscribing!

Setting this to bug report because I feel this is a security related issue. Almost all CMS systems provide this functionality to make sure users are not creating bad passwords.

karschsp’s picture

Issue tags: +Novice

tagging for novice queue

AaronBauman’s picture

Assigned: Unassigned » AaronBauman

What about abstracting this to a new property name "#confirm" that can be applied to ANY field?

I will take that on, unless there are objections.

edited for terminology

AaronBauman’s picture

In this patch:

  • Implementation of #confirm property
  • Simpletests for #confirm property (in modules/simpletest/tests/form.test)
  • JavaScript user feedback ("Confirm values match: yes/no") similar to that of password_confirm FAPI type
  • Basic styling of confirm fields and js user feedback
  • admin/user/settings field to allow admin control over email confirm field on user/register.

Not in this patch:

  • Any changes to password_confirm FAPI field type. The #confirm property implementation has the potential to fully replace password_confirm, but that's not part of this patch.
  • Javascript tests

Feedback welcome -- thanks for reviewing & testing

AaronBauman’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch failed testing.

AaronBauman’s picture

Status: Needs work » Needs review
FileSize
16.21 KB

Status: Needs review » Needs work

The last submitted patch failed testing.

sun’s picture

+1, subscribing.

Your coding style needs work - please read http://drupal.org/coding-standards and sub-pages about comment standards.

AaronBauman’s picture

Status: Needs work » Needs review
FileSize
15.34 KB

rerolled @ HEAD

mcrittenden’s picture

Title: Provide two e-mail fields to ensure accuracy on registration » Create #confirm property to ensure equality of two input fields
Component: user system » field system
Category: bug » feature

Looks like the intent of this issue has changed. +1 for a #confirm property.

mcrittenden’s picture

Status: Needs review » Needs work

Bot hasn't finished testing yet but either way it needs a lot of work from the coding standards standpoint, as sun pointed out.

AaronBauman’s picture

Can you please be a bit more specific w.r.t coding standards?
I ran it through Coder already.

Pasqualle’s picture

Status: Needs work » Needs review
FileSize
15.39 KB

reroll, with code style and translation related changes

yched’s picture

Component: field system » forms system

Change component. This is not related to the Field API.

Status: Needs review » Needs work

The last submitted patch failed testing.

AaronBauman’s picture

Assigned: AaronBauman » Unassigned
mcrittenden’s picture

Version: 7.x-dev » 8.x-dev

Guess it's too late for 7.x now.

Aza-dupe’s picture

Version: 8.x-dev » 6.x-dev

Is this feature now available in 6.x or have you given up?

mcrittenden’s picture

Version: 6.x-dev » 8.x-dev

Aza: this feature won't make it into 6.x...only bug and security fixes go in at this point, and now that 7.x has reached code freeze, it's not making it in there either, so we can only hope for 8.x at this point.

rickmanelius’s picture

Is this still a desired feature? As I understand it, it's a toggle to add in an email confirmation field and test whether both match?

rickmanelius’s picture

PS. What's wrong with leaving in login toboggan? It seems to implement the feature quite well.

pjcdawkins’s picture

Assigned: Unassigned » pjcdawkins
pjcdawkins’s picture

I'm working on this, and it seems to me like a useful addition to the Form API.

The implications of aaronbauman's plan (see #5) are:

  • a #confirm property would become available for relevant Form API types, which would be textfield, email, phone, password. API addition.
  • that the password_confirm type would become redundant, and an API removal seems sensible to remove password_confirm. Password elements needing a 'confirm' input should have #type='password' and #confirm=TRUE
  • it might be sensible to warn about & test for people porting D7 modules who have included a password_confirm type, as it would normally fall back to 'textfield', thus exposing user's passwords (which would be bad)...
  • there might be terminological confusion with #confirm, because it sounds like confirm_form() (which does something completely different). But I don't know of any alternatives except something more wordy like #require_duplicate

It seems that there won't be any code bloat in this, if it simply replaces all the code that deals with password_confirm.

I'm having a go at rerolling aaronbauman's patch which looks like it will be relatively simple to update for D8.

(by the way I haven't written D8 core patches before)

pjcdawkins’s picture

Initial patch, which just rerolls the form.inc, system.module and user.module parts of aaronbauman's patch.

More patches to follow for tests and JS/AJAX changes, and then yet another patch for the (more controversial) removal of password_confirm.

pjcdawkins’s picture

Updated patch (no exotic #states stuff, and configuration is now in the right place under Account settings).

pjcdawkins’s picture

Potential 'title' option for the #confirm property, which aaronbauman suggested in his @todo:

$example = array(
  '#type' => 'email',
  '#title' => t('E-mail address'),
  '#confirm' => array(
    'title' => 'Enter your e-mail address again', // default: 'Confirm ' . $element['#title']
  ),
);
pjcdawkins’s picture

Updated patch, including jQuery client-side validation (by aaronbauman, adapted from user.js). Working here with @Mac_Weber at DrupalCon. No tests yet.

pjcdawkins’s picture

Status: Needs work » Needs review
FileSize
13.31 KB

New complete patch attached (including the PHP, the JavaScript and the tests), doing what aaronbauman describes in #5 above. Patch by @pjcdawkins and @Mac_Weber (novices at DrupalCon Munich).

Note that this patch does not do anything about the password_confirm Form API type (see #5 and #27 above).

pjcdawkins’s picture

Issue summary: View changes

Wrote an up-to-date summary based on the template.

pjcdawkins’s picture

Issue summary: View changes

Removed "// Text of original report here."

thedavidmeister’s picture

Assigned: pjcdawkins » Unassigned
Status: Needs review » Needs work

Needs reworking.

tdm:d8 thedavidmeister$ git apply confirm_property_with_js_and_tests-111322-32.patch 
error: patch failed: core/misc/form.js:80
error: core/misc/form.js: patch does not apply
error: patch failed: core/modules/system/system.module:367
error: core/modules/system/system.module: patch does not apply
error: core/modules/user/lib/Drupal/user/AccountFormController.php: No such file or directory
error: patch failed: core/modules/user/user.admin.inc:310
error: core/modules/user/user.admin.inc: patch does not apply
Note that this patch does not do anything about the password_confirm Form API type (see #5 and #27 above).

This is an important part of the patch though, right?

+ '#value' => is_array($value) ? (isset($value['confirm']) ? $value['confirm'] : NULL) : $value,

The legibility of this line could be improved by splitting it across a few lines.

+  // Set #id to make sure FAPI doesn't bust us for a conflicting DOM id.
+  $element['#id'] = 'rand' . rand();

We have drupal_html_id() for this.

lauriii’s picture

Issue tags: -Novice

This is very old issue so I don't think this is good issue for a novice anymore.

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.

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.

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.

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

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.