From: Tim Düsterhus
Date: Fri, 29 Jul 2016 18:22:48 +0000 (+0200)
Subject: Adapt mail in LostPasswordForm
X-Git-Tag: 3.0.0_Beta_1~890^2~1
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=69c8d66b5c460232541b87eeef1c00959d24994d;p=GitHub%2FWoltLab%2FWCF.git
Adapt mail in LostPasswordForm
---
diff --git a/com.woltlab.wcf/templates/email_lostPassword.tpl b/com.woltlab.wcf/templates/email_lostPassword.tpl
new file mode 100644
index 0000000000..94b405ab2a
--- /dev/null
+++ b/com.woltlab.wcf/templates/email_lostPassword.tpl
@@ -0,0 +1,19 @@
+{if $mimeType === 'text/plain'}
+{capture assign='content'}{lang}wcf.user.lostPassword.mail.plaintext{/lang}{/capture}
+{include file='email_plaintext'}
+{else}
+ {capture assign='content'}
+ {lang}wcf.user.lostPassword.mail.html.headline{/lang}
+ {lang}wcf.user.lostPassword.mail.html.intro{/lang}
+
+ {capture assign=button}
+
+ {lang}wcf.user.lostPassword.mail.html.reset{/lang}
+
+ {/capture}
+ {include file='email_paddingHelper' class='button' content=$button sandbox=true}
+
+ {lang}wcf.user.lostPassword.mail.html.outro{/lang}
+ {/capture}
+ {include file='email_html'}
+{/if}
diff --git a/wcfsetup/install/files/lib/form/LostPasswordForm.class.php b/wcfsetup/install/files/lib/form/LostPasswordForm.class.php
index 3e67a26169..27d2ff5fe7 100644
--- a/wcfsetup/install/files/lib/form/LostPasswordForm.class.php
+++ b/wcfsetup/install/files/lib/form/LostPasswordForm.class.php
@@ -4,11 +4,15 @@ use wcf\data\user\User;
use wcf\data\user\UserAction;
use wcf\system\exception\NamedUserException;
use wcf\system\exception\UserInputException;
-use wcf\system\mail\Mail;
+use wcf\system\email\mime\MimePartFacade;
+use wcf\system\email\mime\RecipientAwareTextMimePart;
+use wcf\system\email\Email;
+use wcf\system\email\UserMailbox;
use wcf\system\request\LinkHandler;
use wcf\system\WCF;
use wcf\util\CryptoUtil;
use wcf\util\HeaderUtil;
+use wcf\util\StringUtil;
/**
* Shows the lost password form.
@@ -106,13 +110,18 @@ class LostPasswordForm extends AbstractCaptchaForm {
]);
$this->objectAction->executeAction();
- // send mail
- $mail = new Mail([$this->user->username => $this->user->email], WCF::getLanguage()->getDynamicVariable('wcf.user.lostPassword.mail.subject'), WCF::getLanguage()->getDynamicVariable('wcf.user.lostPassword.mail', [
- 'username' => $this->user->username,
- 'userID' => $this->user->userID,
- 'key' => $lostPasswordKey
+ // reload object
+ $this->user = new User($this->user->userID);
+
+ $email = new Email();
+ $email->addRecipient(new UserMailbox($this->user));
+ $email->setSubject($this->user->getLanguage()->getDynamicVariable('wcf.user.lostPassword.mail.subject'));
+ $email->setBody(new MimePartFacade([
+ new RecipientAwareTextMimePart('text/html', 'email_lostPassword'),
+ new RecipientAwareTextMimePart('text/plain', 'email_lostPassword')
]));
- $mail->send();
+ $email->send();
+
$this->saved();
// forward to index page
diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml
index dc1489a080..22f1496b89 100644
--- a/wcfsetup/install/lang/de.xml
+++ b/wcfsetup/install/lang/de.xml
@@ -2838,12 +2838,25 @@ Fehler sind beispielsweise:
- - getUser()->username},
-{if LANGUAGE_USE_INFORMAL_VARIANT}wenn du dein Kennwort vergessen hast, kannst du über folgenden Link ein neues Kennwort anfordern.{else}wenn Sie Ihr Kennwort vergessen haben, können Sie über folgenden Link ein neues Kennwort anfordern.{/if}
-{if LANGUAGE_USE_INFORMAL_VARIANT}Klicke{else}Klicken Sie{/if} hier, um ein neues Kennwort anzufordern: {link controller='NewPassword' isEmail=true}u={@$userID}&k={@$key}{/link}
+{if LANGUAGE_USE_INFORMAL_VARIANT}du (oder jemand anders) hat{else}Sie (oder jemand anders) haben{/if} angegeben das Kennwort für das Benutzerkonto
+{@$mailbox->getUser()->username} auf der Seite {@PAGE_TITLE|language} [URL:{link isEmail=true}{/link}] vergessen zu haben. {if LANGUAGE_USE_INFORMAL_VARIANT}Du kannst dein{else}Sie können Ihr{/if} Kennwort
+nach einem Klick auf den Folgenden Link ändern:
-{if LANGUAGE_USE_INFORMAL_VARIANT}Falls du dein Kennwort nicht vergessen hast, kannst du diese E-Mail ignorieren.{else}Falls Sie Ihr Kennwort nicht vergessen haben, können Sie diese E-Mail ignorieren.{/if}]]>
+ {link controller='NewPassword' object=$mailbox->getUser() isEmail=true}k={@$mailbox->getUser()->lostPasswordKey}{/link} {* this line ends with a space *}
+
+Wenn {if LANGUAGE_USE_INFORMAL_VARIANT}du dein{else}Sie Ihr{/if} Kennwort nicht ändern {if LANGUAGE_USE_INFORMAL_VARIANT}möchtest{else}möchten{/if}, dann wird diese Anfrage
+am {$mailbox->getUser()->lastLostPasswordRequestTime+86400|plainTime} automatisch ablaufen.]]>
+ - getUser()->username},]]>
+ - {if LANGUAGE_USE_INFORMAL_VARIANT}du (oder jemand anders) hat{else}Sie (oder jemand anders) haben{/if} angegeben das
+Kennwort für das Benutzerkonto {@$mailbox->getUser()->username} auf der Seite {@PAGE_TITLE|language} vergessen zu
+haben:
]]>
+
+ - Wenn {if LANGUAGE_USE_INFORMAL_VARIANT}du dein{else}Sie Ihr{/if} Kennwort nicht ändern {if LANGUAGE_USE_INFORMAL_VARIANT}möchtest{else}möchten{/if},
+dann wird diese Anfrage am {$mailbox->getUser()->lastLostPasswordRequestTime+86400|plainTime} automatisch ablaufen.]]>
diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml
index e4e94b849d..6ed03af0cb 100644
--- a/wcfsetup/install/lang/en.xml
+++ b/wcfsetup/install/lang/en.xml
@@ -2879,12 +2879,22 @@ Errors are:
- - getUser()->username},
-if you have lost your password you can request a new one using the link below.
-Request a new password: {link controller='NewPassword' isEmail=true}u={@$userID}&k={@$key}{/link}
+you (or someone else) claimed to have lost the password for the user account {@$mailbox->getUser()->username} on
+the website {@PAGE_TITLE|language} [URL:{link isEmail=true}{/link}]. You can change your password after clicking
+the following link:
-If you have not lost your password, you can safely ignore this email.]]>
+ {link controller='NewPassword' object=$mailbox->getUser() isEmail=true}k={@$mailbox->getUser()->lostPasswordKey}{/link} {* this line ends with a space *}
+
+If you donât want to change your password you can simply wait. The request will expire at {$mailbox->getUser()->lastLostPasswordRequestTime+86400|plainTime}.]]>
+ - getUser()->username},]]>
+ - you (or someone else) claimed to have lost the password for the user account {@$mailbox->getUser()->username} on
+the website {@PAGE_TITLE|language}.]]>
+
+ - If you donât want to change your password you can simply wait. The request will expire at {$mailbox->getUser()->lastLostPasswordRequestTime+86400|plainTime}.]]>