forked from Squatconf/Website
Merge branch 'release/1.0'
This commit is contained in:
commit
981afe51d6
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -17,4 +17,5 @@ results
|
||||||
node_modules
|
node_modules
|
||||||
html/assets/js/email*
|
html/assets/js/email*
|
||||||
/config.json
|
/config.json
|
||||||
|
config.js
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
# SquatConf website.
|
# SquatConf website.
|
||||||
|
|
||||||
|
```cp config-sample.js config.js```
|
||||||
|
|
||||||
|
edit congif with the mailgun api key
|
||||||
|
|
||||||
```npm i && npm start```
|
```npm i && npm start```
|
|
@ -6,11 +6,12 @@ module.exports = require('rc')(name, {
|
||||||
db_opts: { valueEncoding: 'json' }
|
db_opts: { valueEncoding: 'json' }
|
||||||
, db_path: join(cwd, 'db', name)
|
, db_path: join(cwd, 'db', name)
|
||||||
, port: 8000
|
, port: 8000
|
||||||
, host: "http://test.squatconf.eu"
|
, host: 'http://test.squatconf.eu'
|
||||||
|
, mailjetKey: 'key-...'
|
||||||
, email: {
|
, email: {
|
||||||
from : "no-reply@squatconf.eu"
|
from : 'no-reply@squatconf.eu'
|
||||||
, subject : "Hello, everyone is welcome at SquatConf.."
|
, subject : 'Hello, everyone is welcome at SquatConf..'
|
||||||
, bodyText : "Please verify that you wish to signup by following this link\n%link%\nYou can ignore this message if you DID NOT request to signup at our website\nhttp://squatconf.eu\n\nThe next event is in Paris, we hope to see you there !!\n\nKind regards from the team,\nSquatConf Paris 2014"
|
, bodyText : 'Please verify that you wish to signup by following this link\n%link%\nYou can ignore this message if you DID NOT request to signup at our website\nhttp://squatconf.eu\n\nThe next event is in Paris, we hope to see you there !!\n\nKind regards from the team,\nSquatConf Paris 2014'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -146,5 +146,15 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="assets/js/email.js"></script>
|
<script src="assets/js/email.js"></script>
|
||||||
|
<script>
|
||||||
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||||
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||||
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||||
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||||
|
|
||||||
|
ga('create', 'UA-8478831-9', 'auto');
|
||||||
|
ga('send', 'pageview');
|
||||||
|
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -74,4 +74,14 @@
|
||||||
|
|
||||||
</footer> -->
|
</footer> -->
|
||||||
</body>
|
</body>
|
||||||
|
<script>
|
||||||
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||||
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||||
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||||
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||||
|
|
||||||
|
ga('create', 'UA-8478831-9', 'auto');
|
||||||
|
ga('send', 'pageview');
|
||||||
|
|
||||||
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
"ecstatic": "^0.5.4",
|
"ecstatic": "^0.5.4",
|
||||||
"level": "^0.18.0",
|
"level": "^0.18.0",
|
||||||
"load-svg": "^1.0.0",
|
"load-svg": "^1.0.0",
|
||||||
"nodemailer": "^1.3.0",
|
"mailgun": "^0.5.0",
|
||||||
"rc": "^0.5.1",
|
"rc": "^0.5.1",
|
||||||
"stack": "^0.1.0",
|
"stack": "^0.1.0",
|
||||||
"tiny-route": "^2.1.1",
|
"tiny-route": "^2.1.1",
|
||||||
|
|
|
@ -18,6 +18,7 @@ if(!fs.existsSync(config.db_path)){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
stack.errorHandler = function error(req, res, err) {
|
stack.errorHandler = function error(req, res, err) {
|
||||||
res.statusCode = 302
|
res.statusCode = 302
|
||||||
res.setHeader('Location', '/')
|
res.setHeader('Location', '/')
|
||||||
|
|
|
@ -10,9 +10,9 @@ process.nextTick(function() {
|
||||||
, status_msg = document.getElementById('status-msg')
|
, status_msg = document.getElementById('status-msg')
|
||||||
, logoCont = document.getElementById('logoCont')
|
, logoCont = document.getElementById('logoCont')
|
||||||
|
|
||||||
loadsvg('/assets/img/squatconf_baguette.svg', function (err, svg) {
|
loadsvg('/assets/img/squatconf_baguette.svg', function (err, svg) {
|
||||||
logoCont.appendChild(svg);
|
logoCont.appendChild(svg);
|
||||||
});
|
});
|
||||||
|
|
||||||
for (var n = 0, l = form.childNodes[1].childNodes.length; n < l; n++) {
|
for (var n = 0, l = form.childNodes[1].childNodes.length; n < l; n++) {
|
||||||
var el = form.childNodes[1].childNodes[n]
|
var el = form.childNodes[1].childNodes[n]
|
||||||
|
|
|
@ -2,6 +2,11 @@ var sanitize = require('xss-escape')
|
||||||
, rn = require('./rng')
|
, rn = require('./rng')
|
||||||
, ip = require('./ip-trace')
|
, ip = require('./ip-trace')
|
||||||
, config = require('../config')
|
, config = require('../config')
|
||||||
|
, Mailgun = require('mailgun').Mailgun
|
||||||
|
, mg = new Mailgun(config.mailjetKey);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = function(db) {
|
module.exports = function(db) {
|
||||||
return function (req, res, next) {
|
return function (req, res, next) {
|
||||||
|
@ -33,29 +38,34 @@ module.exports = function(db) {
|
||||||
if (err) return error(err)
|
if (err) return error(err)
|
||||||
|
|
||||||
// db write OK..
|
// db write OK..
|
||||||
var nodemailer = require('nodemailer')
|
var url = config.host +'/confirm'
|
||||||
, transporter = nodemailer.createTransport()
|
|
||||||
, url = config.host +'/confirm'
|
|
||||||
, qstr = '?email='+ email +'&token='+ obj.token
|
, qstr = '?email='+ email +'&token='+ obj.token
|
||||||
, link = url + qstr +'\n\n'
|
, link = url + qstr +'\n\n'
|
||||||
|
, opts = {
|
||||||
var opts = {
|
|
||||||
from : config.email.from
|
from : config.email.from
|
||||||
, to : email
|
, to : email
|
||||||
, subject: config.email.subject
|
, subject: config.email.subject
|
||||||
, text : config.email.bodyText.replace(/\%link\%/, link)
|
, text : config.email.bodyText.replace(/\%link\%/, link)
|
||||||
}
|
}
|
||||||
|
|
||||||
transporter.sendMail(opts, function(err, data) {
|
mg.sendText(
|
||||||
if (err) return error(err)
|
opts.from
|
||||||
|
, email
|
||||||
|
, opts.subject
|
||||||
|
, opts.text
|
||||||
|
, {}
|
||||||
|
, function(err) {
|
||||||
|
if (err) console.log('Guru meditation: ' + err);
|
||||||
|
else{
|
||||||
|
res.statusCode = 302
|
||||||
|
res.setHeader('Location', '/')
|
||||||
|
console.log('email sent..', opts)}
|
||||||
|
return res.end()
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// validation email sent
|
|
||||||
console.log('email sent..', opts)
|
|
||||||
|
|
||||||
res.statusCode = 302
|
|
||||||
res.setHeader('Location', '/')
|
|
||||||
return res.end()
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
0
src/mail.js
Normal file
0
src/mail.js
Normal file
Loading…
Reference in a new issue