From 4f85fd6c32fa2cd6ccb5302c11f55210cb85dc10 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Tim=20D=C3=BCsterhus?=
diff --git a/com.woltlab.wcf/templates/email_changeEmailNeedReactivation.tpl b/com.woltlab.wcf/templates/email_changeEmailNeedReactivation.tpl
new file mode 100644
index 0000000000..069f5c642e
--- /dev/null
+++ b/com.woltlab.wcf/templates/email_changeEmailNeedReactivation.tpl
@@ -0,0 +1,19 @@
+{if $mimeType === 'text/plain'}
+{capture assign='content'}{lang}wcf.user.changeEmail.needReactivation.mail.plaintext{/lang}{/capture}
+{include file='email_plaintext'}
+{else}
+ {capture assign='content'}
+ {lang}wcf.user.changeEmail.needReactivation.mail.html.headline{/lang}
+ {lang}wcf.user.changeEmail.needReactivation.mail.html.intro{/lang}
+
+ {capture assign=button}
+
+ {lang}wcf.user.changeEmail.needReactivation.mail.html.activate{/lang}
+
+ {/capture}
+ {include file='email_paddingHelper' class='button' content=$button sandbox=true}
+
+ {lang}wcf.user.changeEmail.needReactivation.mail.html.outro{/lang}
+ {/capture}
+ {include file='email_html'}
+{/if}
diff --git a/wcfsetup/install/files/lib/form/AccountManagementForm.class.php b/wcfsetup/install/files/lib/form/AccountManagementForm.class.php
index d8ba03e3c6..2c70a20548 100644
--- a/wcfsetup/install/files/lib/form/AccountManagementForm.class.php
+++ b/wcfsetup/install/files/lib/form/AccountManagementForm.class.php
@@ -2,8 +2,12 @@
namespace wcf\form;
use wcf\data\user\User;
use wcf\data\user\UserAction;
+use wcf\data\user\UserList;
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\menu\user\UserMenu;
use wcf\system\WCF;
use wcf\util\HeaderUtil;
@@ -223,7 +227,7 @@ class AccountManagementForm extends AbstractForm {
// email
if (WCF::getSession()->getPermission('user.profile.canChangeEmail') && $this->email != WCF::getUser()->email && $this->email != WCF::getUser()->newEmail) {
- if (empty($this->email)) {
+ if (empty($this->email)) {
throw new UserInputException('email');
}
@@ -346,14 +350,6 @@ class AccountManagementForm extends AbstractForm {
$updateParameters['reactivationCode'] = $activationCode;
$updateParameters['newEmail'] = $this->email;
- $messageData = [
- 'username' => WCF::getUser()->username,
- 'userID' => WCF::getUser()->userID,
- 'activationCode' => $activationCode
- ];
-
- $mail = new Mail([WCF::getUser()->username => $this->email], WCF::getLanguage()->getDynamicVariable('wcf.user.changeEmail.needReactivation.mail.subject'), WCF::getLanguage()->getDynamicVariable('wcf.user.changeEmail.needReactivation.mail', $messageData));
- $mail->send();
$success[] = 'wcf.user.changeEmail.needReactivation';
}
}
@@ -440,6 +436,25 @@ class AccountManagementForm extends AbstractForm {
HeaderUtil::setCookie('password', PasswordUtil::getSaltedHash($updateParameters['password'], $user->password), TIME_NOW + 365 * 24 * 3600);
}
+ if (isset($updateParameters['newEmail']) && isset($updateParameters['reactivationCode'])) {
+ // Use user list to allow overriding of the fields without duplicating logic
+ $userList = new UserList();
+ $userList->useQualifiedShorthand = false;
+ $userList->sqlSelects .= ", user_table.*, newEmail AS email";
+ $userList->getConditionBuilder()->add('user_table.userID = ?', [WCF::getUser()->userID]);
+ $userList->readObjects();
+ $user = $userList->getObjects()[WCF::getUser()->userID];
+
+ $email = new Email();
+ $email->addRecipient(new UserMailbox($user));
+ $email->setSubject($user->getLanguage()->getDynamicVariable('wcf.user.changeEmail.needReactivation.mail.subject'));
+ $email->setBody(new MimePartFacade([
+ new RecipientAwareTextMimePart('text/html', 'email_changeEmailNeedReactivation'),
+ new RecipientAwareTextMimePart('text/plain', 'email_changeEmailNeedReactivation')
+ ]));
+ $email->send();
+ }
+
$this->saved();
$success = array_merge($success, WCF::getTPL()->get('success') ?: []);
diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml
index 9dc3b5e3c5..320c13d548 100644
--- a/wcfsetup/install/lang/de.xml
+++ b/wcfsetup/install/lang/de.xml
@@ -2912,25 +2912,29 @@ dann wird diese Anfrage am {$mailbox->getUser()->lastLostPasswordRequestTime+864
{$mailbox->getUser()->reactivationCode}
.
+{if LANGUAGE_USE_INFORMAL_VARIANT}Wenn du Probleme mit der Aktivierung haben solltest, wende dich{else}Wenn Sie Probleme mit der Aktivierung haben, wenden Sie sich{/if} bitte an den Administrator: +{MAIL_ADMIN_ADDRESS}. Wenn {if LANGUAGE_USE_INFORMAL_VARIANT}du dich{else}Sie sich{/if} nicht bei uns registriert {if LANGUAGE_USE_INFORMAL_VARIANT}hast{else}haben{/if}, +dann {if LANGUAGE_USE_INFORMAL_VARIANT}kannst du{else}können Sie{/if} diese E-Mail ignorieren.
]]>{$mailbox->getUser()->activationCode}
.
Wenn {if LANGUAGE_USE_INFORMAL_VARIANT}du{else}Sie{/if} Probleme mit der Aktivierung {if LANGUAGE_USE_INFORMAL_VARIANT}deines{else}Ihres{/if} Benutzerkontos {if LANGUAGE_USE_INFORMAL_VARIANT}hast{else}haben{/if}, dann {if LANGUAGE_USE_INFORMAL_VARIANT}wende dich{else}wenden Sie sich{/if} bitte an den Administrator diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 80ac2a37bf..8ad41771ff 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -2939,23 +2939,29 @@ the website {@PAGE_TITLE|language}.
{$mailbox->getUser()->reactivationCode}
.
+If you have troubles confirming your email address, please contact the administrator at: +{MAIL_ADMIN_ADDRESS}. Please ignore this email if +you did not register an account with us.
]]>{$mailbox->getUser()->activationCode}
.
If you have troubles confirming your email address, please contact the administrator at: -- 2.20.1