From 1f962f91154b04c5ec49df14a3e0aa2f4905e1c6 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Tue, 11 Apr 2017 17:24:58 -0500 Subject: Update email template for lost password email Signed-off-by: Morris Jobke --- core/Controller/LostController.php | 22 ++++++++++++++++++---- core/templates/lostpassword/email.php | 21 --------------------- 2 files changed, 18 insertions(+), 25 deletions(-) delete mode 100644 core/templates/lostpassword/email.php (limited to 'core') diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index 639dd9da574..adb317b80fe 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -284,15 +284,29 @@ class LostController extends Controller { $link = $this->urlGenerator->linkToRouteAbsolute('core.lost.resetform', array('userId' => $user->getUID(), 'token' => $token)); - $tmpl = new \OC_Template('core', 'lostpassword/email'); - $tmpl->assign('link', $link); - $msg = $tmpl->fetchPage(); + $emailTemplate = $this->mailer->createEMailTemplate(); + + $emailTemplate->addHeader(); + $emailTemplate->addHeading($this->l10n->t('Password reset')); + + $emailTemplate->addBodyText( + $this->l10n->t('Click the following button to reset your password. If you have not requested the password reset, then ignore this email.'), + $this->l10n->t('Click the following link to reset your password. If you have not requested the password reset, then ignore this email.') + ); + + $emailTemplate->addBodyButton( + $this->l10n->t('Reset your password'), + $link, + false + ); + $emailTemplate->addFooter(); try { $message = $this->mailer->createMessage(); $message->setTo([$email => $user->getUID()]); $message->setSubject($this->l10n->t('%s password reset', [$this->defaults->getName()])); - $message->setPlainBody($msg); + $message->setPlainBody($emailTemplate->renderText()); + $message->setHtmlBody($emailTemplate->renderHTML()); $message->setFrom([$this->from => $this->defaults->getName()]); $this->mailer->send($message); } catch (\Exception $e) { diff --git a/core/templates/lostpassword/email.php b/core/templates/lostpassword/email.php deleted file mode 100644 index 3ca424d5294..00000000000 --- a/core/templates/lostpassword/email.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see - * - */ -echo str_replace('{link}', $_['link'], $l->t('Use the following link to reset your password: {link}')); -- cgit v1.2.3