diff --git a/CHANGELOG.md b/CHANGELOG.md index 03c082859f2..1f90336fbf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ - Fixed an error that could occur when adding new textual condition rules to a condition. ([#12077](https://github.com/craftcms/cms/pull/12077)) - Fixed a bug where Table fields’ Default Values settings were always showing at least one row, even if the setting had been saved without any rows. ([#12071](https://github.com/craftcms/cms/issues/12071)) - Fixed a bug where existing rows in Table fields’ Default Values settings were losing the ability to be reordered or deleted when the table columns were changed. +- Fixed a bug where sending a password reset email for an inactive user would set them to a pending state. ([#12080](https://github.com/craftcms/cms/pull/12080)) ### Security - Fixed information disclosure vulnerabilities. diff --git a/src/controllers/UsersController.php b/src/controllers/UsersController.php index 4aa5743a5be..7478aad809b 100644 --- a/src/controllers/UsersController.php +++ b/src/controllers/UsersController.php @@ -512,7 +512,8 @@ public function actionSendPasswordResetEmail(): ?Response } } - if (!empty($user) && !Craft::$app->getUsers()->sendPasswordResetEmail($user)) { + // Don't try to send the email if there are already error or there is no user + if (empty($errors) && !empty($user) && !Craft::$app->getUsers()->sendPasswordResetEmail($user)) { $errors[] = Craft::t('app', 'There was a problem sending the password reset email.'); }