Fixes.
Added support for help text in custom fields. Reimplemented the mechanism how campaign_messages are created.
This commit is contained in:
parent
025600e818
commit
4e4b77ca84
19 changed files with 223 additions and 200 deletions
|
@ -1,10 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
const crypto = require('crypto');
|
||||
|
||||
module.exports = {
|
||||
enforce,
|
||||
cleanupFromPost,
|
||||
filterObject,
|
||||
castToInteger
|
||||
castToInteger,
|
||||
normalizeEmail,
|
||||
hashEmail
|
||||
};
|
||||
|
||||
function enforce(condition, message) {
|
||||
|
@ -36,4 +40,22 @@ function castToInteger(id, msg) {
|
|||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeEmail(email) {
|
||||
const emailParts = email.split(/@/);
|
||||
|
||||
if (emailParts.length !== 2) {
|
||||
return email;
|
||||
}
|
||||
|
||||
const username = emailParts[0];
|
||||
const domain = emailParts[1].toLowerCase();
|
||||
|
||||
return username + '@' + domain;
|
||||
}
|
||||
|
||||
function hashEmail(email) {
|
||||
return crypto.createHash('sha512').update(normalizeEmail(email)).digest("base64");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue