Problem/Motivation

Avoid using display mode machine name in AccountForm::form() since there could be registration forms with other form display modes (e.g. as in Registration types module).

In AccountForm::form() in

if ($this->getOperation() != 'register') {
  foreach (array('mail', 'name', 'pass') as $key) {
    if (isset($form['account'][$key])) {
      $form['account'][$key]['#attributes']['autocomplete'] = 'off';
    }
  }
}

Proposed resolution

Use if (!$register) { instead of if ($this->getOperation() != 'register') {.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kpv created an issue. See original summary.

kpv’s picture

Issue summary: View changes
shabana.navas’s picture

Replaced if ($this->getOperation() != 'register') with if (!$register).

Dinesh18’s picture

Status: Needs review » Needs work

Hello,

Could you please describe the issue in the below manner. Describe the steps, how to replicate the issue
1)Problem/Motivation
2) Proposed resolution

shabana.navas’s picture

Issue summary: View changes
Status: Needs work » Needs review
kpv’s picture

@shabana.navas thanks

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

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now 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.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now 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.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now 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.

joachim’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

There is existing test coverage of this - see \Drupal\Tests\user\Kernel\UserAccountFormFieldsTest::testUserRegistrationForm - and I don;'t think adding a module that duplicates the functionality of registration types is worth it.

Committed and pushed a324d5be36 to 8.7.x and fd4638ac0c to 8.6.x. Thanks!

Credited @kpv for reporting the issue.

  • alexpott committed a324d5b on 8.7.x
    Issue #2866722 by shabana.navas, kpv: Avoid using display mode machine...

  • alexpott committed fd4638a on 8.6.x
    Issue #2866722 by shabana.navas, kpv: Avoid using display mode machine...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.