Add email registration module support to Password Policy.

Created on 6 December 2023, about 1 year ago
Updated 22 February 2024, 11 months ago

Problem/Motivation

The module does not support the email registration module for the username policy.

Original description:

If the username validation is enabled and the email registration module is enabled, then when the visitor is entering the password and they have entered the email address, the username field has not been set as that is done in the pre save function.

Steps to reproduce

  • Install/configure Drupal
  • Install/configure password_policy and email_registration
  • Update site settings to allow visitor to create account without moderation
  • Add password username constraint to a policy that is applied to all roles
  • Go to /user/register form as anonymous and it will show the email address and password fields
  • Fill in foobar@example.com into the email address and foobar / foobar for the password fields
  • Username constraint will not trigger

Proposed resolution

When email registration is used, determine the username from its logic and check that.

Remaining tasks

  • Update code
  • Review and test
  • Commit

User interface changes

Error will show when appropriate.

API changes

Data model changes

✨ Feature request
Status

Postponed: needs info

Version

4.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom somersoft

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @somersoft
  • Status changed to Postponed: needs info 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States Kristen Pol Santa Cruz, CA, USA

    Not sure I follow. Please add explicit steps to reproduce.

  • Status changed to Needs review 11 months ago
  • πŸ‡¬πŸ‡§United Kingdom somersoft

    Create a Drupal instance with this module enabled and username validation enable.
    Go through the registration process.
    Here is where the password validation happens but the passed in account entity has not yet set the username field.
    It may be that the enabled Email registration module is having affect.

  • Assigned to Kristen Pol
  • πŸ‡ΊπŸ‡ΈUnited States Kristen Pol Santa Cruz, CA, USA

    Thanks for providing more details. I will try to reproduce the issue.

  • πŸ‡ΊπŸ‡ΈUnited States Kristen Pol Santa Cruz, CA, USA

    I tested this and was able to create a new account with the user name check and it showed the error when I tried using the username. Thus, maybe you are correct and it's the email registration module that's causing an issue. I'll try with that.

  • Status changed to Active 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States Kristen Pol Santa Cruz, CA, USA

    I tested with the email registration module and see that it doesn't work with that so I've changed this to a feature request.

  • Status changed to Needs work 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States Kristen Pol Santa Cruz, CA, USA

    I see there is a patch and I just tried that but it doesn't work.

  • Issue was unassigned.
  • Status changed to Postponed: needs info 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States Kristen Pol Santa Cruz, CA, USA

    I tried some other logic based on the email_registration module to get the email address and figure out the username from that but the email address isn't in $user->getEmail() or $user->getInitialEmail() so not sure what to do here.

Production build 0.71.5 2024