Problem/Motivation

_user_mail_notify() is an internal, underscore-prefixed function. Still it is widely used in contrib and likely in custom modules. Some research in #3539178-27: Extract _user_mail_notify() into a user NotificationHandler turned out a non-exhaustive list of modules which for various reasons attempt to send a password reset email.

Some modules dealing with password resets:

Steps to reproduce

Proposed resolution

Expose a public API for initiating a password reset for a particular account. A call to this API should result in a password reset email sent to the address registered with that account.

This could be part of the UserInterface:

/**
  * Returns TRUE if a password reset can be initiated on this account.
  */
public function isPasswordResetEnabled(): bool;

/**
  * Initiate a password reset for the user.
  *
  * Returns TRUE if a password reset message was sent to the owner of this account.
  */
public function initiatePasswordReset(): bool;

Deprecate the password_reset op of _user_mail_notify().

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Comments

znerol created an issue. See original summary.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.