Send IP address to authbox

This commit is contained in:
petehunt 2015-01-03 12:44:10 -08:00
parent 6728cc0dcd
commit 84eab487fd
2 changed files with 8 additions and 7 deletions

View File

@ -6,7 +6,7 @@
}
, "dependencies": {
"express": "~3.5.1"
, "authbox": "^0.9.2"
, "authbox": "^0.9.3"
, "jade": "~0.14.2"
, "mixpanel": "~0.0.19"
, "nodemailer": "~0.6.1"

View File

@ -89,8 +89,14 @@ app.post('/intl', function(req, res) {
// App helper functions
function textRequestHandler(req, res, number, region, key) {
var ip = req.connection.remoteAddress;
if (!ip || ip === '127.0.0.1') {
ip = req.header('X-Real-IP');
}
var authbox_details = {
$actionName: 'text'
$actionName: 'text',
$ipAddress: ip
};
if (!number || !req.body.message) {
@ -122,11 +128,6 @@ function textRequestHandler(req, res, number, region, key) {
return;
}
var ip = req.connection.remoteAddress;
if (!ip || ip === '127.0.0.1') {
ip = req.header('X-Real-IP');
}
var tracking_details = {
number: number,
message: req.body.message,