From 5262cc248484b3e30140a18d0f83a7791c0f7401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Je=CC=81ro=CC=82me=20Loi=CC=88?= Date: Mon, 22 Sep 2014 21:33:44 +0200 Subject: [PATCH 1/3] updated favicon --- html/favicon.ico | Bin 0 -> 6518 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/html/favicon.ico b/html/favicon.ico index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..919fc935a290798078634385d6244ccc1170d593 100644 GIT binary patch literal 6518 zcmeHLS!|To8J(Gqr^YM>+hb!032M}eq)ID76{M=F0(nRu()1yrQXX1V38{N%AT=KlY^ z-}jyGe9Ik&!|8B2Mvr!Ip6Hkq<8XY>;c!fx*#AAr;dqs6leorL_=dI4$>HGo!+(pC zTv(ps#Okq5WO-w;Fwuz*$9p)e^^7Dp-Wu)1ij-Isq`Eje@lJw9EY@<*>alvyg^lA} zNaOlP=gaF~*#?nL0|BJx|6MeLtDtLSOB9?(INB)CaV* zp*LEN)@T?#0pRvO>hPy{Cw5I3PCZ@JGX{U;ciI1E>U?6#_qn&;>~CqTz|0Y`s7s#= z^z@qj&E*|fN1M|UT>Un9XonNoUfJU|vut^Lj1#%ZE*$*9v%uZG=%YU2C~)mYBNh-} zVYvHA7yc0MA%<@Jg|dbF@8Vt9@`MM=h=uGz{b}mb4AA~t|GG^bJ;>u;Jx@=HgJfk= z_J&k9?H^^nFH3e?d#@irC|Zds?v37wVDqee${I$W#28=85At!gcZ9)oCH=H|?6=MN z=&VJ1FGYud8z-;O-c;J{#@?qq)YENjUPRflJ)b^Y!M*a|)+by*={a;o{b-`SzLFM$ zccwRv+={^*;v$`;{~Gc}X9y3i3)fpOK24!Mv_$*R=?`JX$muvVDG_z~D^R^-H}+>{ zAcyCOXX2ao3n%eSoGO}<3Iy(<8$krA|IxJFK=D?d*-Z`rT@`i4H{!Z{ke4!&m<-3? zXoGOo88;XH2BBar+9KRW?80axmw-cOYmhVb4eC3>?9C$XOO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as#e>$k`L&?_j@;Ptd$m~}s>o$$Q!x9%ZxknO1L|u8v^n%nYM4-+V zx1grjhxtF6f%VV*~p^EoXI;+4rQp8>0YNLb3cTzjAFP#sZ@*pM1ydfqks%}70=)-|u;P>t00f^quo%liB%_0N_w&@B7y zeo(bKo0#jnY}34ebtav^WvY${17W1IWWVmm1D$KHKm2>Z Date: Mon, 22 Sep 2014 22:16:59 +0100 Subject: [PATCH 2/3] ignore email signups that already exist and are verified, fixes #9 --- src/email-submit.js | 71 ++++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/src/email-submit.js b/src/email-submit.js index 211459f..6504360 100644 --- a/src/email-submit.js +++ b/src/email-submit.js @@ -19,42 +19,47 @@ module.exports = function(db) { var obj = {} , email = sanitize(params.query.email) - console.log('got email:', params.query) - - obj.token = rn() - obj.verified = false - obj.events = { paris: params.query.paris ? true : false } - obj.trace = ip(req) - - db.put(email, obj, function(err) { - if (err) return error(err) - - // db write OK.. - var nodemailer = require('nodemailer') - , transporter = nodemailer.createTransport() - , url = config.host +'/confirm' - , qstr = '?email='+ email +'&token='+ obj.token - , link = url + qstr +'\n\n' - - var opts = { - from : config.email.from - , to : email - , subject: config.email.subject - //, link : link - , text : config.email.bodyText.replace(/\%link\%/, link) - } + db.get(email, function(err, value) { + if ((err && err.type == 'NotFoundError') || ! value.verified) { + + console.log('got email:', params.query) + + obj.token = rn() + obj.verified = false + obj.events = { paris: params.query.paris ? true : false } + obj.trace = ip(req) + + db.put(email, obj, function(err) { + if (err) return error(err) - transporter.sendMail(opts, function(err, data) { - if (err) return error(err) + // db write OK.. + var nodemailer = require('nodemailer') + , transporter = nodemailer.createTransport() + , url = config.host +'/confirm' + , qstr = '?email='+ email +'&token='+ obj.token + , link = url + qstr +'\n\n' - // validation email sent - console.log('email sent..', opts) + var opts = { + from : config.email.from + , to : email + , subject: config.email.subject + , text : config.email.bodyText.replace(/\%link\%/, link) + } + + transporter.sendMail(opts, function(err, data) { + if (err) return error(err) + + // validation email sent + console.log('email sent..', opts) + + res.statusCode = 302 + res.setHeader('Location', '/') + return res.end() + }) + }) + } + } - res.statusCode = 302 - res.setHeader('Location', '/') - return res.end() - }) - }) } else { error('invalid input: '+ JSON.stringify(params.query)) } From b85c284b870c9c15a159511b52f3f81bc2571e20 Mon Sep 17 00:00:00 2001 From: joates Date: Mon, 22 Sep 2014 23:28:13 +0100 Subject: [PATCH 3/3] handle duplicate email submissions (by silently dropping them) --- src/email-submit.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/email-submit.js b/src/email-submit.js index 6504360..83a3d28 100644 --- a/src/email-submit.js +++ b/src/email-submit.js @@ -57,6 +57,9 @@ module.exports = function(db) { return res.end() }) }) + + } else { + error('already verified: '+ email) } }