Skip to content

Commit

Permalink
Populate emails from .env
Browse files Browse the repository at this point in the history
  • Loading branch information
at0dd committed Aug 12, 2017
1 parent 2d7956f commit 3dbaa95
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 19 deletions.
6 changes: 5 additions & 1 deletion .env.config
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ JWT_SECRET='shhhh super secret code here bro'
ROOT_URL='http://localhost:3000'

# Credentials for the admin user created at app initialization
ADMIN_EMAIL='admin@example.org'
ADMIN_EMAIL='admin@example.com'
ADMIN_PASS='party'

# Used to send verification, registration, and confirmation emails
EMAIL_ADDRESS='[email protected]'
HACKATHON_NAME='Hackathon'
TWITTER_HANDLE='hackathon'
FACEBOOK_HANDLE='hackathon'
EMAIL_CONTACT='Hackathon Team <[email protected]>'
EMAIL_HOST='smtp.gmail.com'
EMAIL_USER='[email protected]'
Expand Down
15 changes: 14 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,22 @@
},
"ADMIN_EMAIL": {
"description": "Credentials for the admin user created at app initialization",
"value": "admin@example.org"
"value": "admin@example.com"
},
"ADMIN_PASS": "party",
"EMAIL_ADDRESS": {
"description": "The email address that is included in the 'email us' link at the bottom of emails.",
"value": "[email protected]"
},
"HACKATHON_NAME": "Hackathon",
"TWITTER_HANDLE": {
"description": "Everything after https://twitter.com/",
"value": "hackathon"
},
"FACEBOOK_HANDLE": {
"description": "Everything after https://facebook.com/",
"value": "hackathon"
},
"EMAIL_CONTACT": {
"description": "Used to send verification, registration, and confirmation emails",
"value": "Hackathon Team <[email protected]>"
Expand Down
17 changes: 13 additions & 4 deletions app/server/services/email.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ var emailTemplates = require('email-templates');

var ROOT_URL = process.env.ROOT_URL;

var HACKATHON_NAME = process.env.HACKATHON_NAME;
var EMAIL_ADDRESS = process.env.EMAIL_ADDRESS;
var TWITTER_HANDLE = proccess.env.TWITTER_HANDLE;
var FACEBOOK_HANDLE = proccess.env.FACEBOOK_HANDLE;

var EMAIL_HOST = process.env.EMAIL_HOST;
var EMAIL_USER = process.env.EMAIL_USER;
var EMAIL_PASS = process.env.EMAIL_PASS;
Expand Down Expand Up @@ -48,6 +53,10 @@ function sendOne(templateName, options, data, callback){
}

data.emailHeaderImage = EMAIL_HEADER_IMAGE;
data.emailAddress = EMAIL_ADDRESS;
data.hackathonName = HACKATHON_NAME;
data.twitterHandle = TWITTER_HANDLE;
data.facebookHandle = FACEBOOK_HANDLE;
template(templateName, data, function(err, html, text){
if (err) {
return callback(err);
Expand Down Expand Up @@ -79,7 +88,7 @@ controller.sendVerificationEmail = function(email, token, callback) {

var options = {
to: email,
subject: "[HACKMIT] - Verify your email"
subject: "[HACKATHON] - Verify your email"
};

var locals = {
Expand Down Expand Up @@ -116,7 +125,7 @@ controller.sendPasswordResetEmail = function(email, token, callback) {

var options = {
to: email,
subject: "[HACKMIT] - Password reset requested!"
subject: "[HACKATHON] - Password reset requested!"
};

var locals = {
Expand Down Expand Up @@ -157,7 +166,7 @@ controller.sendPasswordChangedEmail = function(email, callback){

var options = {
to: email,
subject: "[HACKMIT] - Your password has been changed!"
subject: "[HACKATHON] - Your password has been changed!"
};

var locals = {
Expand Down Expand Up @@ -185,4 +194,4 @@ controller.sendPasswordChangedEmail = function(email, callback){

};

module.exports = controller;
module.exports = controller;
8 changes: 4 additions & 4 deletions app/server/templates/email-basic/html.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<td valign="top" style="text-align: center" class="bodyContent" mc:edit="body_content00">
Thanks,
<br />
The HackMIT Team
The {{ hackathonName }} Team
</td>
</tr>

Expand All @@ -54,13 +54,13 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateFooter">
<tr>
<td valign="top" class="footerContent" mc:edit="footer_content00">
<a href="https://twitter.com/hackmit">Follow on Twitter</a>&nbsp;&nbsp;&nbsp;<a href="https://facebook.com/HackMIT">Like on Facebook</a>&nbsp;&nbsp;&nbsp;
<a href="mailto:[email protected]">Email Us</a>
<a href="https://twitter.com/{{ twitterHandle }}">Follow on Twitter</a>&nbsp;&nbsp;&nbsp;<a href="https://facebook.com/{{ facebookHandle }}">Like on Facebook</a>&nbsp;&nbsp;&nbsp;
<a href="mailto:{{ emailAddress }}">Email Us</a>
</td>
</tr>
<tr>
<td valign="top" class="footerContent" style="padding-top:0;" mc:edit="footer_content01">
<em>Copyright &copy; HackMIT 2015, All rights reserved.</em>
<em>Copyright &copy; {{ hackathonName }} 2017, All rights reserved.</em>
<br />
</td>
</tr>
Expand Down
8 changes: 4 additions & 4 deletions app/server/templates/email-link-action/html.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<td valign="top" style="text-align: center" class="bodyContent" mc:edit="body_content00">
Thanks,
<br />
The HackMIT Team
The {{ hackathonName }} Team
</td>
</tr>

Expand All @@ -60,13 +60,13 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateFooter">
<tr>
<td valign="top" class="footerContent" mc:edit="footer_content00">
<a href="https://twitter.com/hackmit">Follow on Twitter</a>&nbsp;&nbsp;&nbsp;<a href="https://facebook.com/HackMIT">Like on Facebook</a>&nbsp;&nbsp;&nbsp;
<a href="mailto:[email protected]">Email Us</a>
<a href="https://twitter.com/{{ twitterHandle }}">Follow on Twitter</a>&nbsp;&nbsp;&nbsp;<a href="https://facebook.com/{{ facebookHandle }}">Like on Facebook</a>&nbsp;&nbsp;&nbsp;
<a href="mailto:{{ emailAddress }}">Email Us</a>
</td>
</tr>
<tr>
<td valign="top" class="footerContent" style="padding-top:0;" mc:edit="footer_content01">
<em>Copyright &copy; HackMIT 2015, All rights reserved.</em>
<em>Copyright &copy; {{ hackathonName }} 2017, All rights reserved.</em>
<br />
</td>
</tr>
Expand Down
10 changes: 5 additions & 5 deletions app/server/templates/email-verify/html.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<tr>
<td valign="top" style="text-align: center" class="bodyContent" mc:edit="body_content00">
<h1>Verify Your Email</h1>
<h3>Thanks for signing up for HackMIT 2015!</h3>
<h3>Thanks for signing up for {{ hackathonName }}!</h3>
To verify your email, click the button below.
<br />
<br />
Expand All @@ -45,7 +45,7 @@
<td valign="top" style="text-align: center" class="bodyContent" mc:edit="body_content00">
Thanks,
<br />
The HackMIT Team
The {{ hackathonName }} Team
</td>
</tr>

Expand All @@ -60,13 +60,13 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateFooter">
<tr>
<td valign="top" class="footerContent" mc:edit="footer_content00">
<a href="https://twitter.com/hackmit">Follow on Twitter</a>&nbsp;&nbsp;&nbsp;<a href="https://facebook.com/HackMIT">Like on Facebook</a>&nbsp;&nbsp;&nbsp;
<a href="mailto:[email protected]">Email Us</a>
<a href="https://twitter.com/{{ twitterHandle }}">Follow on Twitter</a>&nbsp;&nbsp;&nbsp;<a href="https://facebook.com/{{ facebookHandle }}">Like on Facebook</a>&nbsp;&nbsp;&nbsp;
<a href="mailto:{{ emailAddress }}">Email Us</a>
</td>
</tr>
<tr>
<td valign="top" class="footerContent" style="padding-top:0;" mc:edit="footer_content01">
<em>Copyright &copy; HackMIT 2015, All rights reserved.</em>
<em>Copyright &copy; {{ hackathonName }} 2017, All rights reserved.</em>
<br />
</td>
</tr>
Expand Down

0 comments on commit 3dbaa95

Please sign in to comment.