diff --git a/src/mail_templates/password_reset.ejs b/src/mail_templates/password_reset.ejs
index 08e7bfadb..e4f7faac8 100644
--- a/src/mail_templates/password_reset.ejs
+++ b/src/mail_templates/password_reset.ejs
@@ -1,8 +1,8 @@
<%if (format === 'text') { %>
-Dear <%= user.username || user.alternateEmail || user.email %>,
+Hi <%= user.displayName || user.username || user.alternateEmail || user.email %>,
-Someone, hopefully you, has requested your <%= fqdn %>'s account password
+Someone, hopefully you, has requested your <%= cloudronName %>'s account password
be reset. If you did not request this reset, please ignore this message.
To reset your password, please visit the following page:
@@ -11,10 +11,26 @@ To reset your password, please visit the following page:
When you visit the above page, you will be prompted to enter a new password.
After you have submitted the form, you can login using the new password.
-Thank you,
-<%= fqdn %> Admin
-
<% } else { %>
-<% } %>
+
+
+
+Hi <%= user.displayName || user.username || user.alternateEmail || user.email %>,
+
+
+ Someone, hopefully you, has requested your <%= cloudronName %>'s account password be reset.
+ If you did not request this reset, please ignore this message.
+
+
+
+ Click to reset your password
+
+
+
+ When you visit the above page, you will be prompted to enter a new password.
+ After you have submitted the form, you can login using the new password.
+
+
+<% } %>
diff --git a/src/mailer.js b/src/mailer.js
index 1aeb4a861..eddb9f5fb 100644
--- a/src/mailer.js
+++ b/src/mailer.js
@@ -334,16 +334,36 @@ function passwordReset(user) {
debug('Sending mail for password reset for user %s.', user.email, user.id);
- var resetLink = config.adminOrigin() + '/api/v1/session/password/reset.html?reset_token=' + user.resetToken;
+ settings.getCloudronName(function (error, cloudronName) {
+ if (error) {
+ console.error(error);
+ cloudronName = 'Cloudron';
+ }
- var mailOptions = {
- from: mailConfig().from,
- to: user.alternateEmail || user.email,
- subject: 'Password Reset Request',
- text: render('password_reset.ejs', { fqdn: config.fqdn(), user: user, resetLink: resetLink, format: 'text' })
- };
+ var templateData = {
+ fqdn: config.fqdn(),
+ user: user,
+ resetLink: config.adminOrigin() + '/api/v1/session/password/reset.html?reset_token=' + user.resetToken,
+ cloudronName: cloudronName,
+ cloudronAvatarUrl: config.adminOrigin() + '/api/v1/cloudron/avatar'
+ };
- enqueue(mailOptions);
+ var templateDataText = JSON.parse(JSON.stringify(templateData));
+ templateDataText.format = 'text';
+
+ var templateDataHTML = JSON.parse(JSON.stringify(templateData));
+ templateDataHTML.format = 'html';
+
+ var mailOptions = {
+ from: mailConfig().from,
+ to: user.alternateEmail || user.email,
+ subject: 'Password Reset Request',
+ text: render('password_reset.ejs', templateDataText),
+ html: render('password_reset.ejs', templateDataHTML)
+ };
+
+ enqueue(mailOptions);
+ });
}
function appDied(app) {