Finished adding JSDoc for src/utils
This commit is contained in:
parent
2303c89bcf
commit
7b8c44158f
12 changed files with 229 additions and 20 deletions
|
|
@ -21,6 +21,9 @@ const config = require('../../config.json');
|
|||
const nodeMailer = require("nodemailer");
|
||||
|
||||
//Setup mail transport
|
||||
/**
|
||||
* nodemailer transport object, generated from options specific in our config file
|
||||
*/
|
||||
const transporter = nodeMailer.createTransport({
|
||||
host: config.mail.host,
|
||||
port: config.mail.port,
|
||||
|
|
@ -31,6 +34,14 @@ const transporter = nodeMailer.createTransport({
|
|||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Sends an email as tokebot to the requested user w/ the requested body and signature
|
||||
* @param {String} to - String containing the email address to send to
|
||||
* @param {String} subject - Subject line of the email to send
|
||||
* @param {String} body - Body contents, either HTML or Plaintext
|
||||
* @param {Boolean} htmlBody - Whether or not Body contents should be sent as HTML or Plaintext
|
||||
* @returns {Object} Sent mail info
|
||||
*/
|
||||
module.exports.mailem = async function(to, subject, body, htmlBody = false){
|
||||
//Create mail object
|
||||
const mailObj = {
|
||||
|
|
@ -56,6 +67,12 @@ module.exports.mailem = async function(to, subject, body, htmlBody = false){
|
|||
return sentMail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends address verification email
|
||||
* @param {Mongoose.Document} requestDB - DB Document Object for the current email change request token
|
||||
* @param {Mongoose.Document} userDB - DB Document Object for the user we're verifying email against
|
||||
* @param {String} newEmail - New email address to send to
|
||||
*/
|
||||
module.exports.sendAddressVerification = async function(requestDB, userDB, newEmail){
|
||||
//Send the reset url via email
|
||||
await module.exports.mailem(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue