added device identification to form submissions
This commit is contained in:
parent
7eccc07d02
commit
0d1e76e8ea
|
@ -115,6 +115,10 @@ exports.createSubmission = function(req, res) {
|
||||||
if(ip && process.env.NODE_ENV !== 'development') submission.ipAddr = ip;
|
if(ip && process.env.NODE_ENV !== 'development') submission.ipAddr = ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(req.device){
|
||||||
|
submission.device = req.device;
|
||||||
|
}
|
||||||
|
|
||||||
if(form.autofillPDFs){
|
if(form.autofillPDFs){
|
||||||
try {
|
try {
|
||||||
submission.fdfData = pdfFiller.convFieldJson2FDF(submission.form_fields);
|
submission.fdfData = pdfFiller.convFieldJson2FDF(submission.form_fields);
|
||||||
|
|
|
@ -71,6 +71,14 @@ var FormSubmissionSchema = new Schema({
|
||||||
geoLocation: {
|
geoLocation: {
|
||||||
type: Schema.Types.Mixed,
|
type: Schema.Types.Mixed,
|
||||||
},
|
},
|
||||||
|
device: {
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: String,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
pdfFilePath: {
|
pdfFilePath: {
|
||||||
type: Schema.Types.Mixed,
|
type: Schema.Types.Mixed,
|
||||||
|
|
|
@ -23,6 +23,7 @@ var fs = require('fs-extra'),
|
||||||
config = require('./config'),
|
config = require('./config'),
|
||||||
consolidate = require('consolidate'),
|
consolidate = require('consolidate'),
|
||||||
path = require('path'),
|
path = require('path'),
|
||||||
|
device = require('express-device'),
|
||||||
client = new raven.Client(config.DSN);
|
client = new raven.Client(config.DSN);
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,6 +129,9 @@ module.exports = function(db) {
|
||||||
app.use(passport.initialize());
|
app.use(passport.initialize());
|
||||||
app.use(passport.session());
|
app.use(passport.session());
|
||||||
|
|
||||||
|
// setup express-device
|
||||||
|
app.use(device.capture());
|
||||||
|
|
||||||
// connect flash for flash messages
|
// connect flash for flash messages
|
||||||
app.use(flash());
|
app.use(flash());
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "~5.0.0",
|
"node": "~5.0.0",
|
||||||
"npm": "~2.11.2"
|
"npm": "~3.3.6"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "grunt",
|
"start": "grunt",
|
||||||
|
@ -85,7 +85,9 @@
|
||||||
"shortid": "^2.2.2",
|
"shortid": "^2.2.2",
|
||||||
"soap": "^0.11.0",
|
"soap": "^0.11.0",
|
||||||
"swig": "~1.4.1",
|
"swig": "~1.4.1",
|
||||||
"then-fs": "~2.0.0"
|
"then-fs": "~2.0.0",
|
||||||
|
"useragent": "~2.1.7",
|
||||||
|
"express-device" "~0.4.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"node-mandrill": "^1.0.1",
|
"node-mandrill": "^1.0.1",
|
||||||
|
|
|
@ -44,7 +44,10 @@
|
||||||
Time Elapsed
|
Time Elapsed
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Geolacation
|
Device
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Location
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
IP Address
|
IP Address
|
||||||
|
@ -81,7 +84,10 @@
|
||||||
{{row.timeElapsed}}
|
{{row.timeElapsed}}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{row.geoLocation}}
|
{{row.device.name}}, {{row.device.type}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{row.geoLocation.city}}, {{row.geoLocation.country}}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{row.ipAddr}}
|
{{row.ipAddr}}
|
||||||
|
|
Loading…
Reference in a new issue