- Create Newsletter Page: MailingList (without the class style, using Gulp tasks)#94

This commit is contained in:
Paolo Arena
2019-11-21 00:18:40 +01:00
parent 20a3120054
commit f7fa0c4909
54 changed files with 675 additions and 51 deletions

View File

@@ -0,0 +1,28 @@
const jwt = require('jsonwebtoken');
function toHexString(bytes) {
return Array.from(bytes, byte =>
("00" + (byte & 0xFF).toString(16)).slice(-2)
).join('');
}
module.exports = {
getlinkregByEmail: function (idapp, email, username) {
try{
mystr = idapp + email + username;
return jwt.sign(toHexString(mystr), process.env.SIGNCODE).toString();
} catch (e) {
console.error(e);
}
},
getiPAddressUser: function (req) {
try {
return req.ip; // Express
} catch (e) {
return ''
}
}
};