summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
Diffstat (limited to 'settings')
-rw-r--r--settings/Controller/UsersController.php39
-rw-r--r--settings/templates/email.new_user.php35
-rw-r--r--settings/templates/email.new_user_plain_text.php10
3 files changed, 31 insertions, 53 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()]);
diff --git a/settings/templates/email.new_user.php b/settings/templates/email.new_user.php
deleted file mode 100644
index 9418c21c6cb..00000000000
--- a/settings/templates/email.new_user.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<table cellspacing="0" cellpadding="0" border="0" width="100%">
- <tr><td>
- <table cellspacing="0" cellpadding="0" border="0" width="600px">
- <tr>
- <td colspan="2" bgcolor="<?php p($theme->getColorPrimary());?>" bordercolor="<?php p($theme->getColorPrimary());?>" border>
- <img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.png'))); ?>" alt="<?php p($theme->getName()); ?>"/>
- </td>
- </tr>
- <tr><td colspan="2">&nbsp;</td></tr>
- <tr>
- <td width="20px">&nbsp;</td>
- <td style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;">
- <?php
- print_unescaped($l->t('Hey there,<br><br>just letting you know that you now have a %s account.<br><br>Your username: <strong>%s</strong><br>Access it: <strong><a href="%s">%s</a></strong><br><br>', array($theme->getName(), $_['username'], $_['url'], $_['url'])));
-
- // TRANSLATORS term at the end of a mail
- p($l->t('Cheers!'));
- ?>
- </td>
- </tr>
- <tr><td colspan="2">&nbsp;</td></tr>
- <tr>
- <td width="20px">&nbsp;</td>
- <td style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;">--<br>
- <?php p($theme->getName()); ?> -
- <?php p($theme->getSlogan()); ?>
- <br><a href="<?php p($theme->getBaseUrl()); ?>"><?php p($theme->getBaseUrl());?></a>
- </td>
- </tr>
- <tr>
- <td colspan="2">&nbsp;</td>
- </tr>
- </table>
- </td></tr>
-</table>
diff --git a/settings/templates/email.new_user_plain_text.php b/settings/templates/email.new_user_plain_text.php
deleted file mode 100644
index 2cc70ddfa2f..00000000000
--- a/settings/templates/email.new_user_plain_text.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-print_unescaped($l->t("Hey there,\n\njust letting you know that you now have a %s account.\n\nYour username: %s\nAccess it: %s\n\n", array($theme->getName(), $_['username'], $_['url'])));
-
-// TRANSLATORS term at the end of a mail
-p($l->t("Cheers!"));
-?>
-
- --
-<?php p($theme->getName() . ' - ' . $theme->getSlogan()); ?>
-<?php print_unescaped("\n".$theme->getBaseUrl());