mirror of
https://github.com/Permissionless-Software-Foundation/bch-dex.git
synced 2026-09-21 16:52:00 -07:00
fix(comments): Removing unneeded comments
This commit is contained in:
Vendored
+3
-3
@@ -6,7 +6,7 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
port: process.env.PORT || 5001,
|
port: process.env.PORT || 5001,
|
||||||
logPass: 'test',
|
logPass: 'test',
|
||||||
emailServer: process.env.EMAILSERVER ? process.env.EMAILSERVER : 'mail.launchpadip.net',
|
emailServer: process.env.EMAILSERVER ? process.env.EMAILSERVER : 'mail.someserver.com',
|
||||||
emailUser: process.env.EMAILUSER ? process.env.EMAILUSER : 'noreply@launchpadip.net',
|
emailUser: process.env.EMAILUSER ? process.env.EMAILUSER : 'noreply@someserver.com',
|
||||||
emailPassword: process.env.EMAILPASS ? process.env.EMAILPASS : 'testtest'
|
emailPassword: process.env.EMAILPASS ? process.env.EMAILPASS : 'emailpassword'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,10 @@ class Contact {
|
|||||||
|
|
||||||
// Email list is optional
|
// Email list is optional
|
||||||
if (emailObj.emailList) {
|
if (emailObj.emailList) {
|
||||||
if (!Array.isArray(emailObj.emailList) || !emailObj.emailList.length > 0) {
|
if (
|
||||||
|
!Array.isArray(emailObj.emailList) ||
|
||||||
|
!emailObj.emailList.length > 0
|
||||||
|
) {
|
||||||
throw new Error("Property 'emailList' must be a array of emails!")
|
throw new Error("Property 'emailList' must be a array of emails!")
|
||||||
} else {
|
} else {
|
||||||
_to = emailObj.emailList
|
_to = emailObj.emailList
|
||||||
@@ -69,64 +72,5 @@ class Contact {
|
|||||||
throw err
|
throw err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* // Handles the sending of data via email.
|
|
||||||
async sendEmail (data) {
|
|
||||||
try {
|
|
||||||
// Validate input
|
|
||||||
if (!data.email || typeof data.email !== 'string') {
|
|
||||||
throw new Error('Property \'email\' must be a string!')
|
|
||||||
}
|
|
||||||
const isEmail = await _this.validateEmail(data.email)
|
|
||||||
if (!isEmail) {
|
|
||||||
throw new Error('Property \'email\' must be email format!')
|
|
||||||
}
|
|
||||||
if (!data.formMessage || typeof data.formMessage !== 'string') {
|
|
||||||
throw new Error('Property \'message\' must be a string!')
|
|
||||||
}
|
|
||||||
// create reusable transporter object using the default SMTP transport
|
|
||||||
const transporter = await _this.nodemailer.createTransport({
|
|
||||||
host: 'box.bchtest.net',
|
|
||||||
port: 587,
|
|
||||||
secure: false, // true for 465, false for other ports
|
|
||||||
auth: {
|
|
||||||
user: _this.config.emailUser, // generated ethereal user
|
|
||||||
pass: _this.config.emailPassword // generated ethereal password
|
|
||||||
}
|
|
||||||
})
|
|
||||||
// console.log(`transporter: ${JSON.stringify(transporter.sendMail)}`)
|
|
||||||
const msg = data.formMessage.replace(/(\r\n|\n|\r)/g, '<br />')
|
|
||||||
const now = new Date()
|
|
||||||
const htmlMsg = `
|
|
||||||
<h3>New Contact Form</h3>
|
|
||||||
<p>
|
|
||||||
time: ${now.toLocaleString()}<br />
|
|
||||||
name: ${data.name}<br />
|
|
||||||
email: ${data.email}<br />
|
|
||||||
message: ${msg}<br />
|
|
||||||
</p>
|
|
||||||
`
|
|
||||||
// send mail with defined transport object
|
|
||||||
const info = await transporter.sendMail({
|
|
||||||
from: `${data.email}`, // sender address
|
|
||||||
to: _this.config.emailUser, // list of receivers
|
|
||||||
subject: 'Project Pearson', // Subject line
|
|
||||||
// html: '<b>This is a test email</b>' // html body
|
|
||||||
html: htmlMsg
|
|
||||||
})
|
|
||||||
console.log('Message sent: %s', info.messageId)
|
|
||||||
} catch (err) {
|
|
||||||
console.log('Error in sendEmail()')
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Validate email
|
|
||||||
async validateEmail (email) {
|
|
||||||
// eslint-disable-next-line no-useless-escape
|
|
||||||
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)) {
|
|
||||||
return (true)
|
|
||||||
}
|
|
||||||
return (false)
|
|
||||||
} */
|
|
||||||
}
|
}
|
||||||
module.exports = Contact
|
module.exports = Contact
|
||||||
|
|||||||
Reference in New Issue
Block a user