Problem/Motivation

If user account option is set to Admin required Approval then user cant logged in with his first time password

Steps to reproduce

Change the setting to Admin required Approval
Try to create a new signup and set the password
now once you done that from admin side let approved the user
after approval user cant logged in with his password until he reset the password

CommentFileSizeAuthor
#7 3269073-7.patch1.29 KBrajneeshb
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ahaomar created an issue. See original summary.

vladimiraus’s picture

Version: 8.x-1.0-alpha5 » 2.0.x-dev
Issue summary: View changes
Status: Active » Needs review

Thanks for the issue. Can you confirm the following:

  • Drupal core version
  • Any additional password / redirect related modules?

Possible, the solution is to prevent sending email in

  public function post(UserInterface $account = NULL) {
    $this->ensureAccountCanRegister($account);

    $this->checkEditFieldAccess($account);

    // Make sure that the user entity is valid (email and name are valid).
    $this->validate($account);

    // Create the account.
    $account->save();

    $this->sendEmailNotifications($account);
sanddycool47’s picture

Hi @ vladimiraus,
I am also getting the same issue with Drupal 9.3.12, is there any update or solutions?

skpal’s picture

I found out the following:

  1. This module is only creating the Password field in case when "Visitors, but administrator approval is required" is selected.
  2. The core user module checks the "Visitors, but administrator approval is required" condition and ignores the password field and generates a password as shown in the below code in core\modules\user\src\RegisterForm.php
    $admin = $form_state->getValue('administer_users');
        if (!\Drupal::config('user.settings')->get('verify_mail') || $admin) {
          $pass = $form_state->getValue('pass');
        }
        else {
          $pass = \Drupal::service('password_generator')->generate();
        }

Please suggest some way we can work around this.

vladimiraus’s picture

Status: Needs review » Needs work

This obviously needs work!

ant1’s picture

Any updates around this?

rajneeshb’s picture

Status: Needs work » Needs review
StatusFileSize
new1.29 KB

Created a patch to set password if the password set by the user at registration form.

ant1’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Patch #7 does seem to work. Thanks!

vladimiraus’s picture

Status: Needs work » Needs review
ant1’s picture

Status: Needs review » Reviewed & tested by the community

  • VladimirAus committed e14676a5 on 2.0.x
    Issue #3269073 by VladimirAus, rajneeshb, ant1, ahaomar, skpal: User...
vladimiraus’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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