Skip to content

Commit c6ea890

Browse files
committed
moved variables over to common.js
1 parent 6a8eb04 commit c6ea890

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

api/common.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ exports.TEAMNAME_MAX_CHARS = 75;
1818
exports.HASH_LENGTH = 18;
1919
exports.ASCII = /^[\x20-\x7E]+$/;
2020

21+
// for forgot password
22+
exports.FROM_EMAIL = "[email protected]";
23+
exports.FROM_NAME = "Your CTF";
24+
exports.DOMAIN = "yourctf.com";
25+
26+
// !! IMPORTANT !!
27+
// Don't forget to add SENDGRID_USERNAME and SENDGRID_PASSWORD to your
28+
// environmental variables or to a .env file in the root dir of this
29+
2130
// *********
2231
// DATES
2332
// *********

api/forgot.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
11
var common = require("./common");
22
var moment = require("moment");
33
require("dotenv").load();
4-
5-
// THIS INFO GOES INTO A .env FOLDER OR YOU CAN PROVIDE IT AS ENVIRONMENTAL VARIABLES ON YOUR HOST
64
var sendgrid = require("sendgrid")(process.env.SENDGRID_USERNAME, process.env.SENDGRID_PASSWORD);
75

8-
// *************
9-
// CONSTANTS
10-
// *************
11-
// change this stuff
12-
var FROM_EMAIL = "[email protected]";
13-
var FROM_NAME = "Your CTF";
14-
var DOMAIN = "yourctf.com";
15-
166
exports.send_reset_email = function(req, res) {
177
var email = req.param("email");
188

@@ -83,11 +73,11 @@ exports.send_reset_email = function(req, res) {
8373

8474
sendgrid.send({
8575
to: email,
86-
from: FROM_EMAIL,
87-
fromname: FROM_NAME,
88-
replyto: FROM_EMAIL,
76+
from: common.FROM_EMAIL,
77+
fromname: common.FROM_NAME,
78+
replyto: common.FROM_EMAIL,
8979
subject: "Password Reset Requested.",
90-
html: '<p>Hey there</p><p>Someone (hopefully you) requested to change the password for the account with the email ' + req.param('email') + '. Obviously, we\'ll be asking for verification of identity, so if you did in fact request this, follow this link: http://' + DOMAIN + '/forgot/' + code + "</p><p>" + FROM_NAME + "</p>"
80+
html: '<p>Hey there</p><p>Someone (hopefully you) requested to change the password for the account with the email ' + req.param('email') + '. Obviously, we\'ll be asking for verification of identity, so if you did in fact request this, follow this link: http://' + common.DOMAIN + '/forgot/' + code + "</p><p>" + common.FROM_NAME + "</p>"
9181
}, function(err4, json) {
9282
if (err4) {
9383
console.dir(err4);

0 commit comments

Comments
 (0)