admin email is a platform property
This commit is contained in:
@@ -41,6 +41,7 @@ var assert = require('assert'),
|
||||
ejs = require('ejs'),
|
||||
nodemailer = require('nodemailer'),
|
||||
path = require('path'),
|
||||
platform = require('./platform.js'),
|
||||
safe = require('safetydance'),
|
||||
smtpTransport = require('nodemailer-smtp-transport'),
|
||||
users = require('./user.js'),
|
||||
@@ -161,8 +162,8 @@ function sendMails(queue) {
|
||||
host: mailServerIp,
|
||||
port: config.get('smtpPort'),
|
||||
auth: {
|
||||
user: 'no-reply', // derive from adminEmail
|
||||
pass: 'supersecret'
|
||||
user: platform.mailConfig().username,
|
||||
pass: platform.mailConfig().password
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -222,7 +223,7 @@ function mailUserEventToAdmins(user, event) {
|
||||
adminEmails = _.difference(adminEmails, [ user.email ]);
|
||||
|
||||
var mailOptions = {
|
||||
from: config.adminEmail(),
|
||||
from: platform.mailConfig().from,
|
||||
to: adminEmails.join(', '),
|
||||
subject: util.format('%s %s in Cloudron %s', user.username || user.email, event, config.fqdn()),
|
||||
text: render('user_event.ejs', { fqdn: config.fqdn(), user: user, event: event, format: 'text' }),
|
||||
@@ -248,7 +249,7 @@ function sendInvite(user, invitor) {
|
||||
};
|
||||
|
||||
var mailOptions = {
|
||||
from: config.adminEmail(),
|
||||
from: platform.mailConfig().from,
|
||||
to: user.email,
|
||||
subject: util.format('Welcome to Cloudron %s', config.fqdn()),
|
||||
text: render('welcome_user.ejs', templateData)
|
||||
@@ -271,7 +272,7 @@ function userAdded(user, inviteSent) {
|
||||
var inviteLink = inviteSent ? null : config.adminOrigin() + '/api/v1/session/account/setup.html?reset_token=' + user.resetToken;
|
||||
|
||||
var mailOptions = {
|
||||
from: config.adminEmail(),
|
||||
from: platform.mailConfig().from,
|
||||
to: adminEmails.join(', '),
|
||||
subject: util.format('%s added in Cloudron %s', user.email, config.fqdn()),
|
||||
text: render('user_added.ejs', { fqdn: config.fqdn(), user: user, inviteLink: inviteLink, format: 'text' }),
|
||||
@@ -306,7 +307,7 @@ function passwordReset(user) {
|
||||
var resetLink = config.adminOrigin() + '/api/v1/session/password/reset.html?reset_token=' + user.resetToken;
|
||||
|
||||
var mailOptions = {
|
||||
from: config.adminEmail(),
|
||||
from: platform.mailConfig().from,
|
||||
to: user.email,
|
||||
subject: 'Password Reset Request',
|
||||
text: render('password_reset.ejs', { fqdn: config.fqdn(), user: user, resetLink: resetLink, format: 'text' })
|
||||
@@ -324,7 +325,7 @@ function appDied(app) {
|
||||
if (error) return console.log('Error getting admins', error);
|
||||
|
||||
var mailOptions = {
|
||||
from: config.adminEmail(),
|
||||
from: platform.mailConfig().from,
|
||||
to: adminEmails.concat('support@cloudron.io').join(', '),
|
||||
subject: util.format('App %s is down', app.location),
|
||||
text: render('app_down.ejs', { fqdn: config.fqdn(), title: app.manifest.title, appFqdn: config.appFqdn(app.location), format: 'text' })
|
||||
@@ -342,7 +343,7 @@ function boxUpdateAvailable(newBoxVersion, changelog) {
|
||||
if (error) return console.log('Error getting admins', error);
|
||||
|
||||
var mailOptions = {
|
||||
from: config.adminEmail(),
|
||||
from: platform.mailConfig().from,
|
||||
to: adminEmails.join(', '),
|
||||
subject: util.format('%s has a new update available', config.fqdn()),
|
||||
text: render('box_update_available.ejs', { fqdn: config.fqdn(), webadminUrl: config.adminOrigin(), newBoxVersion: newBoxVersion, changelog: changelog, format: 'text' })
|
||||
@@ -360,7 +361,7 @@ function appUpdateAvailable(app, updateInfo) {
|
||||
if (error) return console.log('Error getting admins', error);
|
||||
|
||||
var mailOptions = {
|
||||
from: config.adminEmail(),
|
||||
from: platform.mailConfig().from,
|
||||
to: adminEmails.join(', '),
|
||||
subject: util.format('%s has a new update available', app.fqdn),
|
||||
text: render('app_update_available.ejs', { fqdn: config.fqdn(), webadminUrl: config.adminOrigin(), app: app, updateInfo: updateInfo, format: 'text' })
|
||||
@@ -374,7 +375,7 @@ function outOfDiskSpace(message) {
|
||||
assert.strictEqual(typeof message, 'string');
|
||||
|
||||
var mailOptions = {
|
||||
from: config.adminEmail(),
|
||||
from: platform.mailConfig().from,
|
||||
to: 'admin@cloudron.io',
|
||||
subject: util.format('[%s] Out of disk space alert', config.fqdn()),
|
||||
text: render('out_of_disk_space.ejs', { fqdn: config.fqdn(), message: message, format: 'text' })
|
||||
@@ -388,7 +389,7 @@ function certificateRenewed(domain, message) {
|
||||
assert.strictEqual(typeof message, 'string');
|
||||
|
||||
var mailOptions = {
|
||||
from: config.adminEmail(),
|
||||
from: platform.mailConfig().from,
|
||||
to: 'admin@cloudron.io',
|
||||
subject: util.format('[%s] Certificate was %s renewed', domain, message ? 'not' : ''),
|
||||
text: render('certificate_renewed.ejs', { domain: domain, message: message, format: 'text' })
|
||||
@@ -404,7 +405,7 @@ function unexpectedExit(program, context) {
|
||||
assert.strictEqual(typeof context, 'string');
|
||||
|
||||
var mailOptions = {
|
||||
from: config.adminEmail(),
|
||||
from: platform.mailConfig().from,
|
||||
to: 'admin@cloudron.io',
|
||||
subject: util.format('[%s] %s exited unexpectedly', config.fqdn(), program),
|
||||
text: render('unexpected_exit.ejs', { fqdn: config.fqdn(), program: program, context: context, format: 'text' })
|
||||
@@ -426,7 +427,7 @@ function sendFeedback(user, type, subject, description) {
|
||||
type === exports.FEEDBACK_TYPE_APP_ERROR);
|
||||
|
||||
var mailOptions = {
|
||||
from: config.adminEmail(),
|
||||
from: platform.mailConfig().from,
|
||||
to: 'support@cloudron.io',
|
||||
subject: util.format('[%s] %s - %s', type, config.fqdn(), subject),
|
||||
text: render('feedback.ejs', { fqdn: config.fqdn(), type: type, user: user, subject: subject, description: description, format: 'text'})
|
||||
|
||||
Reference in New Issue
Block a user