- Import emails from a list to a DB

- Create Template Emails
- Options Email
This commit is contained in:
Paolo Arena
2019-12-04 02:03:44 +01:00
parent f7fa0c4909
commit 6adeb32d46
19 changed files with 1061 additions and 211 deletions

View File

@@ -4,6 +4,8 @@ require('../config/config');
require('../models/subscribers');
const CryptoJS = require('crypto-js');
var Url = require('url-parse');
const { ObjectID } = require('mongodb');
@@ -43,6 +45,7 @@ module.exports = {
number: 64,
typeinrec: 128,
multiselect: 256,
password: 512,
},
MAX_PHASES: 5,
@@ -488,6 +491,33 @@ module.exports = {
let mydate = new Date(new Date().getTime() + secs);
// console.log('mydate', mydate);
return mydate
},
getmd5(mystr) {
return CryptoJS.MD5(mystr.toLowerCase()).toString();
},
getHash(mystr) {
return CryptoJS.SHA512(mystr, { outputLength: 256 }).toString();
},
cryptdata(mydata) {
// Encrypt
return CryptoJS.AES.encrypt(JSON.stringify(data), process.env.SECRK);
},
decryptdata(mydatacrypted) {
// Decrypt
const bytes = CryptoJS.AES.decrypt(mydatacrypted.toString(), process.env.SECRK);
return JSON.parse(bytes.toString(CryptoJS.enc.Utf8));
},
BoolToInt(mybool) {
return (mybool) ? -1 : 0
},
StrToBool(mystr) {
return (mystr === '-1') ? true : false
}
};