Fixed bug #249
This commit is contained in:
parent
7d978c4df1
commit
87f7a050ab
2 changed files with 9 additions and 3 deletions
|
@ -125,7 +125,12 @@ router.post('/subscribe/:listId', (req, res) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/^(yes|true|1)$/i.test(input.REQUIRE_CONFIRMATION)) {
|
if (/^(yes|true|1)$/i.test(input.REQUIRE_CONFIRMATION)) {
|
||||||
confirmations.addConfirmation(list.id, 'subscribe', req.ip, subscription, (err, confirmCid) => {
|
const data = {
|
||||||
|
email: subscription.email,
|
||||||
|
subscriptionData: subscription
|
||||||
|
};
|
||||||
|
|
||||||
|
confirmations.addConfirmation(list.id, 'subscribe', req.ip, data, (err, confirmCid) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
log.error('API', err);
|
log.error('API', err);
|
||||||
res.status(500);
|
res.status(500);
|
||||||
|
|
|
@ -77,6 +77,7 @@ router.get('/confirm/subscribe/:cid', (req, res, next) => {
|
||||||
let optInCountry = geoip.lookupCountry(confirmation.ip) || null;
|
let optInCountry = geoip.lookupCountry(confirmation.ip) || null;
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
|
cid: req.params.cid,
|
||||||
email: data.email,
|
email: data.email,
|
||||||
optInIp: confirmation.ip,
|
optInIp: confirmation.ip,
|
||||||
optInCountry,
|
optInCountry,
|
||||||
|
@ -438,7 +439,7 @@ router.post('/:cid/subscribe', passport.parseForm, corsOrCsrfProtection, (req, r
|
||||||
log.info('Subscription', 'Confirmation message for %s marked to be skipped (%s)', email, JSON.stringify(data));
|
log.info('Subscription', 'Confirmation message for %s marked to be skipped (%s)', email, JSON.stringify(data));
|
||||||
sendWebResponse();
|
sendWebResponse();
|
||||||
} else {
|
} else {
|
||||||
mailHelpers.sendConfirmSubscription(list, email, confirmCid, data, (err) => {
|
mailHelpers.sendConfirmSubscription(list, email, confirmCid, subscriptionData, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return req.xhr ? sendJsonError(err) : sendWebResponse(err);
|
return req.xhr ? sendJsonError(err) : sendWebResponse(err);
|
||||||
}
|
}
|
||||||
|
@ -789,7 +790,7 @@ function handleUnsubscribe(list, subscription, autoUnsubscribe, campaignId, ip,
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Shall we do anything with "found"?
|
// TODO: Shall we do anything with "found"?
|
||||||
|
|
||||||
mailHelpers.sendUnsubscriptionConfirmed(list, subscription.email, subscription, err => {
|
mailHelpers.sendUnsubscriptionConfirmed(list, subscription.email, subscription, err => {
|
||||||
|
|
Loading…
Reference in a new issue