From 8330ac6b6c873aaebf4e6692cef174a456040fe1 Mon Sep 17 00:00:00 2001 From: "A. Vatsaev" Date: Thu, 20 Oct 2016 10:35:26 +0200 Subject: [PATCH] cleanup --- dist/assets/client.js | 6 ++++-- dist/index.js | 2 +- dist/log.js | 4 ++-- dist/splash.js | 2 +- lib/assets/client.js | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dist/assets/client.js b/dist/assets/client.js index fe7f14b..9b86107 100644 --- a/dist/assets/client.js +++ b/dist/assets/client.js @@ -19,7 +19,8 @@ body.addEventListener('submit', function (ev){ button.disabled = true button.className = '' button.innerHTML = 'Please Wait' - invite(channel ? channel.value : null, coc && coc.checked ? 1 : 0, email.value, function (err, msg){ + var gcaptcha_response = form.elements['g-recaptcha-response'] + invite(channel ? channel.value : null, coc && coc.checked ? 1 : 0, email.value, gcaptcha_response.value, function (err, msg){ if (err) { button.removeAttribute('disabled') button.className = 'error' @@ -31,10 +32,11 @@ body.addEventListener('submit', function (ev){ }) }) -function invite (channel, coc, email, fn){ +function invite (channel, coc, email, gcaptcha_response_value, fn){ request .post(data.path + 'invite') .send({ + "g-recaptcha-response": gcaptcha_response_value, coc: coc, channel: channel, email: email diff --git a/dist/index.js b/dist/index.js index 548ce7f..b8bce56 100644 --- a/dist/index.js +++ b/dist/index.js @@ -175,7 +175,7 @@ function slackin(_ref) { } var email = req.body.email; - var captcha_response = req.body.captcha_response; + var captcha_response = req.body['g-recaptcha-response']; if (!email) { return res.status(400).json({ msg: 'No email provided' }); diff --git a/dist/log.js b/dist/log.js index bd88578..eeeb0e9 100644 --- a/dist/log.js +++ b/dist/log.js @@ -47,7 +47,7 @@ function log(slack, silent) { slack.on('ready', function () { if (!slack.org.logo && !silent) { - console.warn('\u001b[92mWARN: no logo configured\u001b[39m'); + console.warn('\x1B[92mWARN: no logo configured\x1B[39m'); } }); } @@ -60,7 +60,7 @@ function log(slack, silent) { } if (args) { - args[0] = new Date() + ' – ' + args[0]; + args[0] = new Date() + ' \u2013 ' + args[0]; } if (silent) return debug.apply(undefined, args); diff --git a/dist/splash.js b/dist/splash.js index b09bf70..187dfff 100644 --- a/dist/splash.js +++ b/dist/splash.js @@ -41,7 +41,7 @@ function splash(_ref) { var pink = '#E01563'; function style() { - var _ref2 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var logo = _ref2.logo; var active = _ref2.active; diff --git a/lib/assets/client.js b/lib/assets/client.js index 8c9a7e6..9b86107 100644 --- a/lib/assets/client.js +++ b/lib/assets/client.js @@ -6,7 +6,6 @@ var request = superagent // elements var form = body.querySelector('form#invite') var channel = form.elements['channel'] || {} -var gcaptcha_response = form.elements['g-recaptcha-response'] var email = form.elements['email'] var coc = form.elements['coc'] var button = body.querySelector('button') @@ -20,6 +19,7 @@ body.addEventListener('submit', function (ev){ button.disabled = true button.className = '' button.innerHTML = 'Please Wait' + var gcaptcha_response = form.elements['g-recaptcha-response'] invite(channel ? channel.value : null, coc && coc.checked ? 1 : 0, email.value, gcaptcha_response.value, function (err, msg){ if (err) { button.removeAttribute('disabled')