API CHANGE Deprecate Member::sendInfo(), use Member_ChangePasswordEmail and Member_ForgotPasswordEmail class directly instead.

This commit is contained in:
Sean Harvey 2012-05-05 10:03:17 +12:00
parent fd0ec1c47f
commit d4154dae9e
2 changed files with 13 additions and 7 deletions

View File

@ -478,6 +478,8 @@ class Member extends DataObject implements TemplateGlobalProvider {
* @param array $data Additional data to pass to the email (can be used in the template) * @param array $data Additional data to pass to the email (can be used in the template)
*/ */
function sendInfo($type = 'signup', $data = null) { function sendInfo($type = 'signup', $data = null) {
Deprecation::notice('3.0', 'Please use Member_ChangePasswordEmail or Member_ForgotPasswordEmail directly instead');
switch($type) { switch($type) {
case "changePassword": case "changePassword":
$e = Member_ChangePasswordEmail::create(); $e = Member_ChangePasswordEmail::create();
@ -644,7 +646,10 @@ class Member extends DataObject implements TemplateGlobalProvider {
&& $this->record['Password'] && $this->record['Password']
&& Member::$notify_password_change && Member::$notify_password_change
) { ) {
$this->sendInfo('changePassword'); $e = Member_ChangePasswordEmail::create();
$e->populateTemplate($this);
$e->setTo($this->Email);
$e->send();
} }
// The test on $this->ID is used for when records are initially created. // The test on $this->ID is used for when records are initially created.

View File

@ -258,12 +258,13 @@ JS
if($member) { if($member) {
$member->generateAutologinHash(); $member->generateAutologinHash();
$member->sendInfo( $e = Member_ForgotPasswordEmail::create();
'forgotPassword', $e->populateTemplate($member);
array( $e->populateTemplate(array(
'PasswordResetLink' => Security::getPasswordResetLink($member->AutoLoginHash) 'PasswordResetLink' => Security::getPasswordResetLink($member->AutoLoginHash)
) ));
); $e->setTo($member->Email);
$e->send();
$this->controller->redirect('Security/passwordsent/' . urlencode($data['Email'])); $this->controller->redirect('Security/passwordsent/' . urlencode($data['Email']));
} elseif($data['Email']) { } elseif($data['Email']) {