summaryrefslogtreecommitdiffstats
path: root/settings/Controller/UsersController.php
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-04-06 13:20:47 -0500
committerMorris Jobke <hey@morrisjobke.de>2017-04-07 12:03:32 -0500
commit0560e6991323c156e548792c5fb1f82791868d90 (patch)
treeabaf978794200348c6975caa5fc13ca551474209 /settings/Controller/UsersController.php
parent325f925e147ff711d12f1b433c6aa6c55d79fb40 (diff)
downloadnextcloud-server-0560e6991323c156e548792c5fb1f82791868d90.tar.gz
nextcloud-server-0560e6991323c156e548792c5fb1f82791868d90.zip
New layout for welcome email
* thanks to @espina2 for make this nice design * the button says "Set password" if the admin didn't specified a password Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'settings/Controller/UsersController.php')
-rw-r--r--settings/Controller/UsersController.php39
1 files changed, 31 insertions, 8 deletions
diff --git a/settings/Controller/UsersController.php b/settings/Controller/UsersController.php
index 19c5b068167..3688cb7b7e2 100644
--- a/settings/Controller/UsersController.php
+++ b/settings/Controller/UsersController.php
@@ -33,6 +33,7 @@ namespace OC\Settings\Controller;
use OC\Accounts\AccountManager;
use OC\AppFramework\Http;
use OC\ForbiddenException;
+use OC\Mail\EMailTemplate;
use OC\User\User;
use OCP\App\IAppManager;
use OCP\AppFramework\Controller;
@@ -443,17 +444,39 @@ class UsersController extends Controller {
$link = $this->urlGenerator->getAbsoluteURL('/');
}
- // data for the mail template
- $mailData = array(
- 'username' => $username,
- 'url' => $link
+
+
+ $emailTemplate = new EMailTemplate($this->defaults);
+
+ $emailTemplate->addHeader($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('', 'logo-mail-header.png')));
+
+ $displayname = $user->getDisplayName();
+ if ($displayname === $username) {
+ $emailTemplate->addHeading($this->l10n->t('Welcome aboard'));
+ } else {
+ $emailTemplate->addHeading($this->l10n->t('Welcome aboard %s', $displayname));
+ }
+ $emailTemplate->addBodyText($this->l10n->t('You have now an Nextcloud account, you can add, protect, and share your data.'));
+ $emailTemplate->addBodyText($this->l10n->t('Your username is: %s', [$username]));
+
+ if ($generatedPassword) {
+ $leftButtonText = $this->l10n->t('Set your password');
+ } else {
+ $leftButtonText = $this->l10n->t('Go to %s', [$this->defaults->getName()]);
+ }
+
+ $emailTemplate->addBodyButtonGroup(
+ $leftButtonText, $link,
+ $this->l10n->t('Install Client'), 'https://nextcloud.com/install/#install-clients'
);
- $mail = new TemplateResponse('settings', 'email.new_user', $mailData, 'blank');
- $mailContent = $mail->render();
+ $emailTemplate->addFooter(
+ $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('', 'logo-mail-footer.png')),
+ $this->defaults->getName() . ' - ' . $this->defaults->getSlogan() . '<br>' . $this->l10n->t('This is an automatically generated email, please do not reply.')
+ );
- $mail = new TemplateResponse('settings', 'email.new_user_plain_text', $mailData, 'blank');
- $plainTextMailContent = $mail->render();
+ $mailContent = $emailTemplate->renderHTML();
+ $plainTextMailContent = $emailTemplate->renderText();
$subject = $this->l10n->t('Your %s account was created', [$this->defaults->getName()]);