ENH: Add extension hooks to core emails

This commit is contained in:
Loz Calver 2022-05-13 09:18:24 +01:00
parent 6c3edb2b52
commit 903dd860b7
2 changed files with 7 additions and 3 deletions

View File

@ -914,7 +914,7 @@ class Member extends DataObject
&& static::config()->get('notify_password_change')
&& $this->isInDB()
) {
Email::create()
$email = Email::create()
->setHTMLTemplate('SilverStripe\\Control\\Email\\ChangePasswordEmail')
->setData($this)
->setTo($this->Email)
@ -922,8 +922,10 @@ class Member extends DataObject
__CLASS__ . '.SUBJECTPASSWORDCHANGED',
"Your password has been changed",
'Email subject'
))
->send();
));
$this->extend('updateChangedPasswordEmail', $email);
$email->send();
}
// The test on $this->ID is used for when records are initially created. Note that this only works with

View File

@ -242,6 +242,8 @@ class LostPasswordHandler extends RequestHandler
))
->addData('PasswordResetLink', Security::getPasswordResetLink($member, $token))
->setTo($member->Email);
$member->extend('updateForgotPasswordEmail', $email);
return $email->send();
}