diff --git a/README.md b/README.md index d3555d2f..e6937067 100755 --- a/README.md +++ b/README.md @@ -27,7 +27,6 @@ Currently following features are implemented: #TODO: -Implement encryption for all form data - -Finish frontend/backend testing -Integrate AWS for PDF saving -Add Typeform API integration -Add plugin/3rd party integration support (ala Slack) diff --git a/app/controllers/forms.server.controller.js b/app/controllers/forms.server.controller.js index ee989396..99d09107 100644 --- a/app/controllers/forms.server.controller.js +++ b/app/controllers/forms.server.controller.js @@ -107,6 +107,8 @@ exports.createSubmission = function(req, res) { percentageComplete: req.body.percentageComplete }); + if(!!form.plugins.oscarhost.baseUrl) submission.hasPlugins.oscarhost == true; + if(form.pdf) submission.pdf = form.pdf; //Save submitter's IP Address diff --git a/app/models/form.server.model.js b/app/models/form.server.model.js index e96ec84d..80db875b 100644 --- a/app/models/form.server.model.js +++ b/app/models/form.server.model.js @@ -195,24 +195,24 @@ FormSchema.plugin(mUtilities.timestamp, { modifiedPath: 'lastModified', useVirtual: false }); -FormSchema.pre('save', function (next) { +FormSchema.pre('init', function (next) { var validUpdateTypes= mongoose.model('Form').schema.path('plugins.oscarhost.settings.updateType').enumValues; this.plugins.oscarhost.settings.validUpdateTypes = validUpdateTypes; - this.plugins.oscarhost.settings.validFields = [ - 'address', - 'city', - 'email', - 'firstName', - 'hin', - 'lastName', - 'phone', - 'postal', - 'province', - 'sex', - 'spokenLanguage', - 'title', - 'DOB']; + // this.plugins.oscarhost.settings.validFields = [ + // 'address', + // 'city', + // 'email', + // 'firstName', + // 'hin', + // 'lastName', + // 'phone', + // 'postal', + // 'province', + // 'sex', + // 'spokenLanguage', + // 'title', + // 'DOB']; next(); }); //Delete template PDF of current Form @@ -359,14 +359,12 @@ FormSchema.pre('save', function (next) { next(); }); - }else if(_original){ - if(_original.pdf){ - fs.remove(_original.pdf.path, function (err) { - if(err) next(err); - console.log('file at '+_original.pdf.path+' successfully deleted'); - next(); - }); - } + }else if(_original.hasOwnProperty('pdf')){ + fs.remove(_original.pdf.path, function (err) { + if(err) next(err); + console.log('file at '+_original.pdf.path+' successfully deleted'); + next(); + }); } next(); }); diff --git a/app/models/form_submission.server.model.js b/app/models/form_submission.server.model.js index 05183635..941318a8 100644 --- a/app/models/form_submission.server.model.js +++ b/app/models/form_submission.server.model.js @@ -6,7 +6,7 @@ var mongoose = require('mongoose'), Schema = mongoose.Schema, pdfFiller = require('pdffiller'), - satelize = require('satelize'), + freegeoip = require('node-freegeoip'), _ = require('lodash'), config = require('../../config/config'), path = require('path'), @@ -69,7 +69,15 @@ var FormSubmissionSchema = new Schema({ type: String, }, geoLocation: { - type: Schema.Types.Mixed, + Country: { + type: String, + }, + Region: { + type: String, + }, + City: { + type: String, + } }, device: { type: { @@ -100,6 +108,13 @@ var FormSubmissionSchema = new Schema({ //TODO: DAVID: Need to not have this hardcoded oscarDemoNum: { type: Number, + }, + + hasPlugins: { + oscarhost: { + type: Boolean, + default: false, + } } }); @@ -114,112 +129,117 @@ FormSubmissionSchema.plugin(mUtilities.timestamp, { FormSubmissionSchema.pre('save', function (next) { var self = this; - mongoose.model('Form').findById(self.form, function(err, _form){ - var form_ids = _.map(_.pluck(_form.form_fields, '_id'), function(id){ return ''+id;}), - submission_ids = _.pluck(self.form_fields, '_id'); - // console.log('Form form_field ids\n--------'); - // console.log(form_ids); - // console.log('FormSubmission [form_field ids]\n--------'); - // console.log(submission_ids); + if(this.hasPlugins.oscarhost){ + mongoose.model('Form').findById(self.form, function(err, _form){ + var form_ids = _.map(_.pluck(_form.form_fields, '_id'), function(id){ return ''+id;}), + submission_ids = _.pluck(self.form_fields, '_id'); - if(err) next(err); - // console.log(_form); - // console.log('should push to api'); - // console.log( (!this.oscarDemoNum && !!_form.plugins.oscarhost.baseUrl && !!_form.plugins.oscarhost.settings.fieldMap) ); - if(!this.oscarDemoNum && _form.plugins.oscarhost.baseUrl && _form.plugins.oscarhost.settings.fieldMap){ - console.log('OSCARHOST API HOOK'); - var url_login = _form.plugins.oscarhost.baseUrl+'/LoginService?wsdl', - url_demo = _form.plugins.oscarhost.baseUrl+'/DemographicService?wsdl'; + // console.log('Form form_field ids\n--------'); + // console.log(form_ids); + // console.log('FormSubmission [form_field ids]\n--------'); + // console.log(submission_ids); - var args_login = {arg0: config.oscarhost.auth.user, arg1: config.oscarhost.auth.pass}; + if(err) next(err); + // console.log(_form); + // console.log('should push to api'); + // console.log( (!this.oscarDemoNum && !!_form.plugins.oscarhost.baseUrl && !!_form.plugins.oscarhost.settings.fieldMap) ); + if(!this.oscarDemoNum && _form.plugins.oscarhost.baseUrl && _form.plugins.oscarhost.settings.fieldMap){ + console.log('OSCARHOST API HOOK'); + var url_login = _form.plugins.oscarhost.baseUrl+'/LoginService?wsdl', + url_demo = _form.plugins.oscarhost.baseUrl+'/DemographicService?wsdl'; - var options = { - ignoredNamespaces: { - namespaces: ['targetNamespace', 'typedNamespace'], - override: true - } - }; - // console.log(self.form_fields); + var args_login = {arg0: config.oscarhost.auth.user, arg1: config.oscarhost.auth.pass}; - //Generate demographics from hashmap - var generateDemo = function(formFields, conversionMap, demographicsTemplate){ - console.log('generating Demo fields'); - console.log(conversionMap); - var _generatedDemo = {}, currField, propertyName; + var options = { + ignoredNamespaces: { + namespaces: ['targetNamespace', 'typedNamespace'], + override: true + } + }; + // console.log(self.form_fields); - for(var y=0; y + + + Code coverage report for All files + + + + + + + +
+
+

+ / +

+
+
+ 33.9% + Statements + 319/941 +
+
+ 21.03% + Branches + 86/409 +
+
+ 26.98% + Functions + 51/189 +
+
+ 34.6% + Lines + 319/922 +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
kiosk_form/
76.19%16/2150%2/450%1/276.19%16/21
kiosk_form/app/controllers/
11.61%18/1550%0/750%0/2512.08%18/149
kiosk_form/app/controllers/users/
20.33%49/2417.83%9/11514.52%9/6220.59%49/238
kiosk_form/app/models/
25.78%74/28711.02%14/12718.87%10/5326.62%74/278
kiosk_form/app/routes/
90%27/30100%0/050%3/690%27/30
kiosk_form/config/
77.37%106/13750%15/3076.92%20/2677.94%106/136
kiosk_form/config/env/
100%3/3100%44/44100%0/0100%3/3
kiosk_form/config/strategies/
37.29%22/5914.29%2/1461.54%8/1337.29%22/59
kiosk_form/scripts/oscarhost/
50%4/8100%0/00%0/250%4/8
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/controllers/core.server.controller.js.html b/coverageServer/lcov-report/kiosk_form/app/controllers/core.server.controller.js.html new file mode 100644 index 00000000..89e01173 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/controllers/core.server.controller.js.html @@ -0,0 +1,101 @@ + + + + Code coverage report for kiosk_form/app/controllers/core.server.controller.js + + + + + + + +
+
+

+ all files / kiosk_form/app/controllers/ core.server.controller.js +

+
+
+ 66.67% + Statements + 2/3 +
+
+ 0% + Branches + 0/2 +
+
+ 0% + Functions + 0/1 +
+
+ 66.67% + Lines + 2/3 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13  +  + +  +  +  +  + +  +  +  +  + 
'use strict';
+ 
+var config = require('../../config/config');
+ 
+/**
+ * Module dependencies.
+ */
+exports.index = function(req, res) {
+	res.render('index', {
+		user: req.user || null,
+		request: req
+	});
+};
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/controllers/errors.server.controller.js.html b/coverageServer/lcov-report/kiosk_form/app/controllers/errors.server.controller.js.html new file mode 100644 index 00000000..2723a209 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/controllers/errors.server.controller.js.html @@ -0,0 +1,191 @@ + + + + Code coverage report for kiosk_form/app/controllers/errors.server.controller.js + + + + + + + +
+
+

+ all files / kiosk_form/app/controllers/ errors.server.controller.js +

+
+
+ 11.11% + Statements + 2/18 +
+
+ 0% + Branches + 0/7 +
+
+ 0% + Functions + 0/2 +
+
+ 11.76% + Lines + 2/17 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + 
'use strict';
+ 
+/**
+ * Get unique error field name
+ */
+var getUniqueErrorMessage = function(err) {
+	var output;
+ 
+	try {
+		var fieldName = err.err.substring(err.err.lastIndexOf('.$') + 2, err.err.lastIndexOf('_1'));
+		output = fieldName.charAt(0).toUpperCase() + fieldName.slice(1) + ' already exists';
+ 
+	} catch (ex) {
+		output = 'Unique field already exists';
+	}
+ 
+	return output;
+};
+ 
+/**
+ * Get the error message from error object
+ */
+exports.getErrorMessage = function(err) {
+	var message = '';
+ 
+	if (err.code) {
+		switch (err.code) {
+			case 11000:
+			case 11001:
+				message = getUniqueErrorMessage(err);
+				break;
+			default:
+				message = 'Something went wrong';
+		}
+	} else {
+		for (var errName in err.errors) {
+			if (err.errors[errName].message) message = err.errors[errName].message;
+		}
+	}
+ 
+	return message;
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/controllers/forms.server.controller.js.html b/coverageServer/lcov-report/kiosk_form/app/controllers/forms.server.controller.js.html new file mode 100644 index 00000000..0d9a7adf --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/controllers/forms.server.controller.js.html @@ -0,0 +1,1052 @@ + + + + Code coverage report for kiosk_form/app/controllers/forms.server.controller.js + + + + + + + +
+
+

+ all files / kiosk_form/app/controllers/ forms.server.controller.js +

+
+
+ 9.09% + Statements + 12/132 +
+
+ 0% + Branches + 0/66 +
+
+ 0% + Functions + 0/22 +
+
+ 9.45% + Lines + 12/127 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var mongoose = require('mongoose'),
+	errorHandler = require('./errors.server.controller'),
+	Form = mongoose.model('Form'),
+	FormSubmission = mongoose.model('FormSubmission'),
+	pdfFiller = require('pdffiller'),
+	config = require('../../config/config'),
+	fs = require('fs-extra'),
+	async = require('async'),
+	path = require('path'),
+	_ = require('lodash');
+ 
+/**
+ * Upload PDF 
+ */
+exports.uploadPDF = function(req, res, next) {
+ 
+	// console.log('inside uploadPDF');
+ 
+	// console.log(req.files.file);
+	// console.log('\n\nProperty Descriptor\n-----------');
+	// console.log(Object.getOwnPropertyDescriptor(req.files.file, 'path'));
+	
+	if(req.file){
+		var pdfFile = req.file;
+		var _user = req.user;
+		if (req.file.size === 0) {
+			next(new Error('File uploaded is EMPTY'));
+		}else if(req.files.size > 200000000){
+			next(new Error('File uploaded exceeds MAX SIZE of 200MB'));
+		}else {
+			fs.exists(pdfFile.path, function(exists) { 
+				//If file exists move to user's tmp directory
+				if(exists) { 
+ 
+					var newDestination = config.tmpUploadPath+_user.username;
+				    var stat = null;
+				    try {
+				        stat = fs.statSync(newDestination);
+				    } catch (err) {
+				        fs.mkdirSync(newDestination);
+				    }
+				    if (stat && !stat.isDirectory()) {
+				    	console.log('Directory cannot be created');
+				        next(new Error('Directory cannot be created because an inode of a different type exists at "' + newDestination + '"'));
+				    }
+				    
+				    fs.move(pdfFile.path, path.join(newDestination, pdfFile.name), function (err) {
+						if (err) {
+							next(new Error(err.message));
+						}
+						pdfFile.path = path.join(newDestination, pdfFile.name);
+						console.log(pdfFile.name + ' uploaded to ' + pdfFile.path);
+						res.json(pdfFile);
+					});				
+ 
+				} else { 
+					next(new Error('Did NOT get your file!'));
+				} 
+			}); 
+		}
+	}else {
+		next(new Error('Uploaded files were NOT detected'));
+	}
+};
+ 
+/**
+ * Delete a forms submissions
+ */
+exports.deleteSubmissions = function(req, res) {
+	console.log(req.body);
+ 
+	var submission_id_list = req.body.deleted_submissions,
+		form = req.form;
+ 
+	FormSubmission.remove({ form: req.form, admin: req.user, _id: {$in: submission_id_list} }, function(err){
+		
+		if(err){
+			res.status(400).send({
+				message: errorHandler.getErrorMessage(err)
+			});
+		}
+ 
+		res.status(200).send('Form submissions successfully deleted');
+	});
+};
+ 
+/**
+ * Submit a form entry
+ */
+exports.createSubmission = function(req, res) {
+ 
+	var form = req.form;
+	// console.log('in createSubmission()');
+	// console.log(req.body);
+ 
+	var submission = new FormSubmission({
+		admin: req.form.admin._id,
+		form: req.form._id,
+		title: req.form.title,
+		form_fields: req.body.form_fields,
+		timeElapsed: req.body.timeElapsed,
+		percentageComplete: req.body.percentageComplete
+	});
+ 
+	if(!!form.plugins.oscarhost.baseUrl) submission.hasPlugins.oscarhost == true;
+ 
+	if(form.pdf) submission.pdf = form.pdf;
+ 
+	//Save submitter's IP Address
+	if(req.headers['x-forwarded-for'] || req.connection.remoteAddress){
+		var ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
+		if(ip && process.env.NODE_ENV !== 'development') submission.ipAddr = ip;
+	}
+ 
+	if(req.device){
+		submission.device = req.device;
+	}
+ 
+	if(form.autofillPDFs){
+		try {
+			submission.fdfData = pdfFiller.convFieldJson2FDF(submission.form_fields);
+		} catch(err){
+			res.status(400).send({
+				message: errorHandler.getErrorMessage(err)
+			});
+		}
+	}else{
+		submission.fdfData = null;
+	}
+ 
+	submission.save(function(err, submission){
+		// console.log('in submissions.save()\n submission: '+JSON.stringify(submission) ) 
+		if(err){
+			console.log(err.message);
+			res.status(400).send({
+				message: errorHandler.getErrorMessage(err)
+			});
+		}
+		res.status(200).send('Form submission successfully saved');
+	});
+};
+ 
+/**
+ * Get List of Submissions for a given Form
+ */
+exports.listSubmissions = function(req, res) {
+	var _form = req.form;
+	var _user = req.user;
+	console.log('listSubmissions');
+ 
+	FormSubmission.find({ form: _form._id }).exec(function(err, _submissions) {
+		if (err) {
+			console.log(err);
+			res.status(400).send({
+				message: errorHandler.getErrorMessage(err)
+			});
+		}
+ 
+		_form.update({ $set : { submissions: _submissions }}).exec(function(err, form){
+			if (err) {
+				console.log(err);
+				res.status(400).send({
+					message: errorHandler.getErrorMessage(err)
+				});
+			} 
+			res.json(_submissions);
+		});
+	
+	});
+ 
+};
+ 
+/**
+ * Create a new form
+ */
+exports.create = function(req, res) {
+	var form = new Form(req.body.form);
+ 
+	form.admin = req.user._id;
+	// console.log('Create a new form');
+	// console.log(form);
+	// console.log(req.body.form)
+	// console.log(req.user);
+ 
+	form.save(function(err) {
+		if (err) {
+			console.log(err);
+			res.status(400).send({
+				message: errorHandler.getErrorMessage(err)
+			});
+		} else {
+			res.json(form);
+		}
+	});
+};
+ 
+/**
+ * Show the current form
+ */
+exports.read = function(req, res) {
+	var validUpdateTypes= Form.schema.path('plugins.oscarhost.settings.updateType').enumValues;
+ 
+	var newForm = JSON.parse(JSON.stringify(req.form));
+	newForm.plugins.oscarhost.settings.validUpdateTypes = validUpdateTypes;
+	res.json(newForm);
+};
+ 
+/**
+ * Update a form
+ */
+exports.update = function(req, res) { 
+	var form = req.form;
+	delete req.body.form.__v;
+	delete req.body.form._id;
+ 
+	//Unless we have 'admin' priviledges, updating form admin is disabled
+	if(req.user.roles.indexOf('admin') === -1) delete req.body.form.admin;
+ 
+	//Do this so we can create duplicate fields
+	var checkForValidId = new RegExp("^[0-9a-fA-F]{24}$");
+	for(var i=0; i<req.body.form.form_fields.length; i++){
+		var field = req.body.form.form_fields[i];
+		if(!checkForValidId.exec(field._id+'')){
+			delete field._id;
+		}
+	}
+	
+	form = _.extend(form, req.body.form);
+	
+	form.save(function(err, form) {
+		if (err) {
+			console.log(err);
+			res.status(400).send({
+				message: errorHandler.getErrorMessage(err)
+			});
+		} else {
+			res.json(form);
+		}
+	});
+};
+ 
+/**
+ * Delete a form
+ */
+exports.delete = function(req, res) {
+	var form = req.form;
+	// console.log('deleting form');
+	Form.remove({_id: form._id}, function(err) {
+		if (err) {
+			res.status(400).send({
+				message: errorHandler.getErrorMessage(err)
+			});
+		} else {
+			// console.log('Form successfully deleted');
+			// res.status(200).send('Form successfully deleted');
+			res.json(form);
+		}
+	});
+};
+ 
+/**
+ * Get All of Users' Forms
+ */
+exports.list = function(req, res) {
+	//Allow 'admin' user to view all forms
+	var searchObj = {admin: req.user};
+	if(req.user.isAdmin()) searchObj = {};
+ 
+	Form.find(searchObj).sort('-created').populate('admin.username', 'admin._id').exec(function(err, forms) {
+		if (err) {
+			res.status(400).send({
+				message: errorHandler.getErrorMessage(err)
+			});
+		} else {
+			res.json(forms);
+		}
+	});
+};
+ 
+/**
+ * Form middleware
+ */
+exports.formByID = function(req, res, next, id) {
+ 
+	if (!mongoose.Types.ObjectId.isValid(id)) {
+		return res.status(400).send({
+			message: 'Form is invalid'
+		});
+	}
+	else {
+		Form.findById(id).populate('admin').exec(function(err, form) {
+			if (err) {
+				return next(err);
+			} else if (form === undefined || form === null) {
+				res.status(400).send({
+					message: 'Form not found'
+				});
+			}
+			else {
+				//Remove sensitive information from User object
+				form.admin.password = undefined;
+				form.admin.salt = undefined;
+				form.provider = undefined;
+				
+				req.form = form;
+				next();
+			}
+		});
+	}
+};
+ 
+/**
+ * Form authorization middleware
+ */
+exports.hasAuthorization = function(req, res, next) {
+ 
+	var form = req.form;
+	if (req.form.admin.id !== req.user.id && req.user.roles.indexOf('admin') === -1) {
+		res.status(403).send({
+			message: 'User '+req.user.username+' is not authorized to edit Form: '+form.title
+		});
+	}
+	next();
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/controllers/index.html b/coverageServer/lcov-report/kiosk_form/app/controllers/index.html new file mode 100644 index 00000000..a00861a4 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/controllers/index.html @@ -0,0 +1,132 @@ + + + + Code coverage report for kiosk_form/app/controllers/ + + + + + + + +
+
+

+ all files kiosk_form/app/controllers/ +

+
+
+ 11.61% + Statements + 18/155 +
+
+ 0% + Branches + 0/75 +
+
+ 0% + Functions + 0/25 +
+
+ 12.08% + Lines + 18/149 +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
core.server.controller.js
66.67%2/30%0/20%0/166.67%2/3
errors.server.controller.js
11.11%2/180%0/70%0/211.76%2/17
forms.server.controller.js
9.09%12/1320%0/660%0/229.45%12/127
users.server.controller.js
100%2/2100%0/0100%0/0100%2/2
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/controllers/users.server.controller.js.html b/coverageServer/lcov-report/kiosk_form/app/controllers/users.server.controller.js.html new file mode 100644 index 00000000..93fb6df7 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/controllers/users.server.controller.js.html @@ -0,0 +1,113 @@ + + + + Code coverage report for kiosk_form/app/controllers/users.server.controller.js + + + + + + + +
+
+

+ all files / kiosk_form/app/controllers/ users.server.controller.js +

+
+
+ 100% + Statements + 2/2 +
+
+ 100% + Branches + 0/0 +
+
+ 100% + Functions + 0/0 +
+
+ 100% + Lines + 2/2 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17  +  +  +  +  + +  +  +  +  + +  +  +  +  +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var _ = require('lodash');
+ 
+/**
+ * Extend user's controller
+ */
+module.exports = _.extend(
+	require('./users/users.authentication.server.controller'),
+	require('./users/users.authorization.server.controller'),
+	require('./users/users.password.server.controller'),
+	require('./users/users.profile.server.controller')
+);
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/controllers/users/index.html b/coverageServer/lcov-report/kiosk_form/app/controllers/users/index.html new file mode 100644 index 00000000..3067e4a1 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/controllers/users/index.html @@ -0,0 +1,132 @@ + + + + Code coverage report for kiosk_form/app/controllers/users/ + + + + + + + +
+
+

+ all files kiosk_form/app/controllers/users/ +

+
+
+ 20.33% + Statements + 49/241 +
+
+ 7.83% + Branches + 9/115 +
+
+ 14.52% + Functions + 9/62 +
+
+ 20.59% + Lines + 49/238 +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
users.authentication.server.controller.js
31.3%36/11515.79%9/5736%9/2531.58%36/114
users.authorization.server.controller.js
18.18%4/220%0/100%0/618.18%4/22
users.password.server.controller.js
7.5%6/800%0/400%0/277.69%6/78
users.profile.server.controller.js
12.5%3/240%0/80%0/412.5%3/24
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/controllers/users/users.authentication.server.controller.js.html b/coverageServer/lcov-report/kiosk_form/app/controllers/users/users.authentication.server.controller.js.html new file mode 100644 index 00000000..8b734793 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/controllers/users/users.authentication.server.controller.js.html @@ -0,0 +1,968 @@ + + + + Code coverage report for kiosk_form/app/controllers/users/users.authentication.server.controller.js + + + + + + + +
+
+

+ all files / kiosk_form/app/controllers/users/ users.authentication.server.controller.js +

+
+
+ 31.3% + Statements + 36/115 +
+
+ 15.79% + Branches + 9/57 +
+
+ 36% + Functions + 9/25 +
+
+ 31.58% + Lines + 36/114 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302  +  +  +  +  + +  +  +  +  +  +  +  +  +  + +  +  + +  + +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  + +  +  +  +  + +  +  + +  + +  + + + +  +  +  + +  +  +  + +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  + +  +  + +  +  + + +  +  + +  + +  +  +  +  +  +  +  +  + + + +  +  +  +  +  +  + + +  +  +  +  +  +  +  +  +  +  +  +  +  + + + + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var _ = require('lodash'),
+	errorHandler = require('../errors.server.controller'),
+	mongoose = require('mongoose'),
+	passport = require('passport'),
+	async = require('async'),
+	config = require('../../../config/config'),
+	nodemailer = require('nodemailer'),
+	crypto = require('crypto'),
+	User = mongoose.model('User');
+ 
+var nev = require('email-verification')(mongoose);
+ 
+// NEV setup and configuration ================
+var config_nev = function () {
+ 
+	var User = require('../../models/user.server.model');
+ 
+	nev.configure({
+	    persistentUserModel: User,
+	    tempUserCollection: config.tempUserCollection,
+	    expirationTime: 1800,  // 30 minutes
+ 
+	    verificationURL: config.baseUrl+'/#!/verify/${URL}',
+	    transportOptions: config.mailer.options,
+	    verifyMailOptions: {
+	        from: config.mailer.from,
+	        subject: 'Confirm your account',
+	        html: '<p>Please verify your account by clicking <a href="${URL}">this link</a>. If you are unable to do so, copy and ' +
+	                'paste the following link into your browser:</p><p>${URL}</p>',
+	        text: 'Please verify your account by clicking the following link, or by copying and pasting it into your browser: ${URL}'
+	    },
+ 
+	    confirmMailOptions: {
+	        from: config.mailer.from,
+	        subject: 'Account successfully verified!',
+	        html: '<p>Your account has been successfully verified.</p>',
+	        text: 'Your account has been successfully verified.'
+	    },
+	    verifySendMailCallback: function(err, info) {
+	      Iif (err) {
+	        throw err;
+	      } else {
+	        console.log(info);
+	      }
+	    },
+ 
+	});
+	nev.generateTempUserModel(User);
+};
+ 
+config_nev();
+ 
+var smtpTransport = nodemailer.createTransport(config.mailer.options);
+ 
+exports.validateVerificationToken = function(req, res){
+	nev.confirmTempUser(req.params.token, function(err, user) {
+	    Iif(err) { 
+			console.log(errorHandler.getErrorMessage(err));
+			return res.status(500).send( {message: errorHandler.getErrorMessage(err) } );
+	    } 
+	    else Iif (user){
+	        return res.status(200).send('User successfully verified');
+	    }else {
+	        // redirect to resend verification email
+	        return res.status(400).send( {message: 'Verification token is invalid or has expired'} );
+	    }
+	});
+};
+ 
+exports.resendVerificationEmail = function(req, res, next){
+	nev.resendVerificationEmail(req.body.email, function(err, userFound) {
+		if(err) { 
+			console.log(errorHandler.getErrorMessage(err));
+			return res.status(500).send( {message: errorHandler.getErrorMessage(err)  } );
+	    } 
+ 
+	    if (userFound){
+	    	console.log('hello');
+	        res.status(200).send('Verification email successfully Re-Sent');
+	    }else {
+	        // user hasn't been found yet
+	        res.status(400).send( {message: 'Error: User has not been registered yet'} );
+	    }
+	});
+};
+ 
+ 
+/**
+ * Signup
+ */
+exports.signup = function(req, res) {
+	// For security measurement we remove the roles from the req.body object
+	delete req.body.roles;
+ 
+	// Init Variables
+	var user = new User(req.body);
+ 
+	// Add missing user fields
+	user.provider = 'local';
+	user.username = user.email;
+ 
+	// Then save the temporary user
+	nev.createTempUser(user, function(err, newTempUser) {
+		
+		Iif (err) {
+			console.log('Error: ');
+			console.log(err);
+			return res.status(400).send({
+				message: errorHandler.getErrorMessage(err)
+			});
+		}else {
+ 
+	        // new user created
+	        Eif (newTempUser) {
+	        	nev.registerTempUser(newTempUser, function (err) {
+	        		Iif (err) {
+	        			console.log('Error: ');
+						console.log(err);
+						return res.status(400).send({
+							message: errorHandler.getErrorMessage(err)
+						});
+					}else {
+						console.log('new tmpuser registered');
+						return res.status(200).send('An email has been sent to you. Please check it to verify your account.');
+	        		}
+	        	});
+	        } else {
+	        	console.log('Error: User already exists!');
+	            return res.status(400).send({ message: 'Error: User already exists!' });
+	        }
+	    }
+    });
+};
+ 
+/**
+ * Signin after passport authentication
+ */
+exports.signin = function(req, res, next) {
+	passport.authenticate('local', function(err, user, info) {
+		Eif (err || !user) {
+			res.status(400).send(info);
+		} else {
+			// Remove sensitive data before login
+			user.password = undefined;
+			user.salt = undefined;
+			user.provider = undefined;
+ 
+			req.login(user, function(err) {
+				if (err) {
+					return res.status(400).send({
+						message: errorHandler.getErrorMessage(err)
+					});
+				} else {
+					return res.json(user);
+				}
+			});
+		}
+	})(req, res, next);
+};
+ 
+/**
+ * Signout
+ */
+exports.signout = function(req, res) {
+	req.logout();
+	res.redirect('/');
+	return res.end();
+};
+ 
+/**
+ * OAuth callback
+ */
+exports.oauthCallback = function(strategy) {
+	return function(req, res, next) {
+		passport.authenticate(strategy, function(err, user, redirectURL) {
+			if (err || !user) {
+				return res.redirect('/#!/signin');
+			}
+			req.login(user, function(err) {
+				if (err) {
+					return res.redirect('/#!/signin');
+				}
+ 
+				return res.redirect(redirectURL || '/');
+			});
+		})(req, res, next);
+	};
+};
+ 
+/**
+ * Helper function to save or update a OAuth user profile
+ */
+exports.saveOAuthUserProfile = function(req, providerUserProfile, done) {
+	if (!req.user) {
+		// Define a search query fields
+		var searchMainProviderIdentifierField = 'providerData.' + providerUserProfile.providerIdentifierField;
+		var searchAdditionalProviderIdentifierField = 'additionalProvidersData.' + providerUserProfile.provider + '.' + providerUserProfile.providerIdentifierField;
+ 
+		// Define main provider search query
+		var mainProviderSearchQuery = {};
+		mainProviderSearchQuery.provider = providerUserProfile.provider;
+		mainProviderSearchQuery[searchMainProviderIdentifierField] = providerUserProfile.providerData[providerUserProfile.providerIdentifierField];
+ 
+		// Define additional provider search query
+		var additionalProviderSearchQuery = {};
+		additionalProviderSearchQuery[searchAdditionalProviderIdentifierField] = providerUserProfile.providerData[providerUserProfile.providerIdentifierField];
+ 
+		// Define a search query to find existing user with current provider profile
+		var searchQuery = {
+			$or: [mainProviderSearchQuery, additionalProviderSearchQuery]
+		};
+ 
+		User.findOne(searchQuery, function(err, user) {
+			if (err) {
+				return done(err);
+			} else {
+				if (!user) {
+					var possibleUsername = providerUserProfile.username || ((providerUserProfile.email) ? providerUserProfile.email.split('@')[0] : '');
+ 
+					User.findUniqueUsername(possibleUsername, null, function(availableUsername) {
+						user = new User({
+							firstName: providerUserProfile.firstName,
+							lastName: providerUserProfile.lastName,
+							username: availableUsername,
+							displayName: providerUserProfile.displayName,
+							email: providerUserProfile.email,
+							provider: providerUserProfile.provider,
+							providerData: providerUserProfile.providerData
+						});
+ 
+						// And save the user
+						user.save(function(err) {
+							return done(err, user);
+						});
+					});
+				} else {
+					return done(err, user);
+				}
+			}
+		});
+	} else {
+		// User is already logged in, join the provider data to the existing user
+		var user = req.user;
+ 
+		// Check if user exists, is not signed in using this provider, and doesn't have that provider data already configured
+		if (user.provider !== providerUserProfile.provider && (!user.additionalProvidersData || !user.additionalProvidersData[providerUserProfile.provider])) {
+			// Add the provider data to the additional provider data field
+			if (!user.additionalProvidersData) user.additionalProvidersData = {};
+			user.additionalProvidersData[providerUserProfile.provider] = providerUserProfile.providerData;
+ 
+			// Then tell mongoose that we've updated the additionalProvidersData field
+			user.markModified('additionalProvidersData');
+ 
+			// And save the user
+			user.save(function(err) {
+				return done(err, user, '/#!/settings/accounts');
+			});
+		} else {
+			return done(new Error('User is already connected using this provider'), user);
+		}
+	}
+};
+ 
+/**
+ * Remove OAuth provider
+ */
+exports.removeOAuthProvider = function(req, res, next) {
+	var user = req.user;
+	var provider = req.param('provider');
+ 
+	if (user && provider) {
+		// Delete the additional provider
+		if (user.additionalProvidersData[provider]) {
+			delete user.additionalProvidersData[provider];
+ 
+			// Then tell mongoose that we've updated the additionalProvidersData field
+			user.markModified('additionalProvidersData');
+		}
+ 
+		user.save(function(err) {
+			if (err) {
+				return res.status(400).send({
+					message: errorHandler.getErrorMessage(err)
+				});
+			} else {
+				req.login(user, function(err) {
+					if (err) {
+						res.status(400).send(err);
+					} else {
+						res.json(user);
+					}
+				});
+			}
+		});
+	}
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/controllers/users/users.authorization.server.controller.js.html b/coverageServer/lcov-report/kiosk_form/app/controllers/users/users.authorization.server.controller.js.html new file mode 100644 index 00000000..7eebaf15 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/controllers/users/users.authorization.server.controller.js.html @@ -0,0 +1,257 @@ + + + + Code coverage report for kiosk_form/app/controllers/users/users.authorization.server.controller.js + + + + + + + +
+
+

+ all files / kiosk_form/app/controllers/users/ users.authorization.server.controller.js +

+
+
+ 18.18% + Statements + 4/22 +
+
+ 0% + Branches + 0/10 +
+
+ 0% + Functions + 0/6 +
+
+ 18.18% + Lines + 4/22 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65  +  +  +  +  + +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var _ = require('lodash'),
+	mongoose = require('mongoose'),
+	User = mongoose.model('User');
+ 
+/**
+ * User middleware
+ */
+exports.userByID = function (req, res, next, id) {
+  if (!mongoose.Types.ObjectId.isValid(id)) {
+    return res.status(400).send({
+      message: 'User is invalid'
+    });
+  }
+ 
+  User.findOne({
+    _id: id
+  }).exec(function (err, user) {
+    if (err) {
+      return next(err);
+    } else if (!user) {
+      return next(new Error('Failed to load User ' + id));
+    }
+ 
+    req.profile = user;
+    next();
+  });
+};
+ 
+/**
+ * Require login routing middleware
+ */
+exports.requiresLogin = function(req, res, next) {
+	if (!req.isAuthenticated()) {
+		return res.status(401).send({
+			message: 'User is not logged in'
+		});
+	}else {
+		return next();
+	}
+};
+ 
+/**
+ * User authorizations routing middleware
+ */
+exports.hasAuthorization = function(roles) {
+	var _this = this;
+ 
+	return function(req, res, next) {
+		_this.requiresLogin(req, res, function() {
+			if (_.intersection(req.user.roles, roles).length) {
+				return next();
+			} else {
+				return res.status(403).send({
+					message: 'User is not authorized'
+				});
+			}
+		});
+	};
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/controllers/users/users.password.server.controller.js.html b/coverageServer/lcov-report/kiosk_form/app/controllers/users/users.password.server.controller.js.html new file mode 100644 index 00000000..c90a072c --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/controllers/users/users.password.server.controller.js.html @@ -0,0 +1,812 @@ + + + + Code coverage report for kiosk_form/app/controllers/users/users.password.server.controller.js + + + + + + + +
+
+

+ all files / kiosk_form/app/controllers/users/ users.password.server.controller.js +

+
+
+ 7.5% + Statements + 6/80 +
+
+ 0% + Branches + 0/40 +
+
+ 0% + Functions + 0/27 +
+
+ 7.69% + Lines + 6/78 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250  +  +  +  +  + +  +  +  +  +  +  +  +  +  + +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var _ = require('lodash'),
+	errorHandler = require('../errors.server.controller'),
+	mongoose = require('mongoose'),
+	passport = require('passport'),
+	User = mongoose.model('User'),
+	config = require('../../../config/config'),
+	nodemailer = require('nodemailer'),
+	async = require('async'),
+	crypto = require('crypto');
+ 
+var smtpTransport = nodemailer.createTransport(config.mailer.options);
+ 
+/**
+ * Forgot for reset password (forgot POST)
+ */
+exports.forgot = function(req, res, next) {
+	async.waterfall([
+		// Generate random token
+		function(done) {
+			crypto.randomBytes(20, function(err, buffer) {
+				var token = buffer.toString('hex');
+				done(err, token);
+			});
+		},
+		// Lookup user by username
+		function(token, done) {
+			if (req.body.username) {
+				User.findOne({
+					username: req.body.username
+				}, '-salt -password', function(err, user) {
+					if (!user) {
+						return res.status(400).send({
+							message: 'No account with that username has been found'
+						});
+					} else if (user.provider !== 'local') {
+						return res.status(400).send({
+							message: 'It seems like you signed up using your ' + user.provider + ' account'
+						});
+					} else {
+						user.resetPasswordToken = token;
+						user.resetPasswordExpires = Date.now() + 3600000; // 1 hour
+ 
+						user.save(function(err) {
+							done(err, token, user);
+						});
+					}
+				});
+			} else {
+				return res.status(400).send({
+					message: 'Username field must not be blank'
+				});
+			}
+		},
+		function(token, user, done) {
+			res.render('templates/reset-password-email', {
+				name: user.displayName,
+				appName: config.app.title,
+				url: 'http://' + req.headers.host + '/auth/reset/' + token
+			}, function(err, emailHTML) {
+				done(err, emailHTML, user);
+			});
+		},
+		// If valid email, send reset email using service
+		function(emailHTML, user, done) {
+			var mailOptions = {
+				to: user.email,
+				from: config.mailer.from,
+				subject: 'Password Reset',
+				html: emailHTML
+			};
+			smtpTransport.sendMail(mailOptions, function(err) {
+				if (!err) {
+					res.send({
+						message: 'An email has been sent to ' + user.email + ' with further instructions.'
+					});
+				} else {
+					return res.status(400).send({
+						message: 'Failure sending email'
+					});
+				}
+ 
+				done(err);
+			});
+		}
+	], function(err) {
+		if (err) return next(err);
+	});
+};
+ 
+/**
+ * Reset password GET from email token
+ */
+exports.validateResetToken = function(req, res) {
+	User.findOne({
+		resetPasswordToken: req.params.token,
+		resetPasswordExpires: {
+			$gt: Date.now()
+		}
+	}, function(err, user) {
+		if (!user) {
+			return res.redirect('/#!/password/reset/invalid');
+		}
+ 
+		res.redirect('/#!/password/reset/' + req.params.token);
+	});
+};
+ 
+/**
+ * Reset password POST from email token
+ */
+exports.reset = function(req, res, next) {
+	// Init Variables
+	var passwordDetails = req.body;
+ 
+	async.waterfall([
+ 
+		function(done) {
+			User.findOne({
+				resetPasswordToken: req.params.token,
+				resetPasswordExpires: {
+					$gt: Date.now()
+				}
+			}, function(err, user) {
+				if (!err && user) {
+					if (passwordDetails.newPassword === passwordDetails.verifyPassword) {
+						user.password = passwordDetails.newPassword;
+						user.resetPasswordToken = undefined;
+						user.resetPasswordExpires = undefined;
+ 
+						user.save(function(err) {
+							if (err) {
+								return res.status(400).send({
+									message: errorHandler.getErrorMessage(err)
+								});
+							} else {
+								req.login(user, function(err) {
+									if (err) {
+										res.status(400).send(err);
+									} else {
+										// Return authenticated user
+										res.json(user);
+ 
+										done(err, user);
+									}
+								});
+							}
+						});
+					} else {
+						return res.status(400).send({
+							message: 'Passwords do not match'
+						});
+					}
+				} else {
+					return res.status(400).send({
+						message: 'Password reset token is invalid or has expired.'
+					});
+				}
+			});
+		},
+		function(user, done) {
+			res.render('templates/reset-password-confirm-email', {
+				name: user.displayName,
+				appName: config.app.title
+			}, function(err, emailHTML) {
+				done(err, emailHTML, user);
+			});
+		},
+		// If valid email, send reset email using service
+		function(emailHTML, user, done) {
+			var mailOptions = {
+				to: user.email,
+				from: config.mailer.from,
+				subject: 'Your password has been changed',
+				html: emailHTML
+			};
+ 
+			smtpTransport.sendMail(mailOptions, function(err) {
+				done(err, 'done');
+			});
+		}
+	], function(err) {
+		if (err) return next(err);
+	});
+};
+ 
+/**
+ * Change Password
+ */
+exports.changePassword = function(req, res) {
+	// Init Variables
+	var passwordDetails = req.body;
+ 
+	if (req.user) {
+		if (passwordDetails.newPassword) {
+			User.findById(req.user.id, function(err, user) {
+				if (!err && user) {
+					if (user.authenticate(passwordDetails.currentPassword)) {
+						if (passwordDetails.newPassword === passwordDetails.verifyPassword) {
+							user.password = passwordDetails.newPassword;
+ 
+							user.save(function(err) {
+								if (err) {
+									return res.status(400).send({
+										message: errorHandler.getErrorMessage(err)
+									});
+								} else {
+									req.login(user, function(err) {
+										if (err) {
+											res.status(400).send(err);
+										} else {
+											res.send({
+												message: 'Password changed successfully'
+											});
+										}
+									});
+								}
+							});
+						} else {
+							res.status(400).send({
+								message: 'Passwords do not match'
+							});
+						}
+					} else {
+						res.status(400).send({
+							message: 'Current password is incorrect'
+						});
+					}
+				} else {
+					res.status(400).send({
+						message: 'User is not found'
+					});
+				}
+			});
+		} else {
+			res.status(400).send({
+				message: 'Please provide a new password'
+			});
+		}
+	} else {
+		res.status(400).send({
+			message: 'User is not signed in'
+		});
+	}
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/controllers/users/users.profile.server.controller.js.html b/coverageServer/lcov-report/kiosk_form/app/controllers/users/users.profile.server.controller.js.html new file mode 100644 index 00000000..647becd1 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/controllers/users/users.profile.server.controller.js.html @@ -0,0 +1,257 @@ + + + + Code coverage report for kiosk_form/app/controllers/users/users.profile.server.controller.js + + + + + + + +
+
+

+ all files / kiosk_form/app/controllers/users/ users.profile.server.controller.js +

+
+
+ 12.5% + Statements + 3/24 +
+
+ 0% + Branches + 0/8 +
+
+ 0% + Functions + 0/4 +
+
+ 12.5% + Lines + 3/24 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65  +  +  +  +  + +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var _ = require('lodash'),
+	errorHandler = require('../errors.server.controller.js'),
+	mongoose = require('mongoose'),
+	passport = require('passport'),
+	User = mongoose.model('User');
+ 
+/**
+ * Update user details
+ */
+exports.update = function(req, res) {
+	// Init Variables
+	var user = req.user;
+	var message = null;
+ 
+	// For security measurement we remove the roles from the req.body object
+	delete req.body.roles;
+ 
+	if (user) {
+		// Merge existing user
+		user = _.extend(user, req.body);
+		user.updated = Date.now();
+		// user.displayName = user.firstName + ' ' + user.lastName;
+ 
+		user.save(function(err) {
+			if (err) {
+				return res.status(400).send({
+					message: errorHandler.getErrorMessage(err)
+				});
+			} else {
+				req.login(user, function(err) {
+					if (err) {
+						res.status(400).send(err);
+					} else {
+						res.json(user);
+					}
+				});
+			}
+		});
+	} else {
+		res.status(400).send({
+			message: 'User is not signed in'
+		});
+	}
+};
+ 
+/**
+ * Send User
+ */
+exports.getUser = function(req, res) {
+	var _user = req.user;
+	delete _user.password;
+	delete _user.salt;
+	delete _user.provider;
+	delete _user.__v;
+ 
+	res.json(req.user || null);
+ 
+	res.end();
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/models/form.server.model.js.html b/coverageServer/lcov-report/kiosk_form/app/models/form.server.model.js.html new file mode 100644 index 00000000..cc0428c2 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/models/form.server.model.js.html @@ -0,0 +1,1535 @@ + + + + Code coverage report for kiosk_form/app/models/form.server.model.js + + + + + + + +
+
+

+ all files / kiosk_form/app/models/ form.server.model.js +

+
+
+ 16.94% + Statements + 21/124 +
+
+ 3.33% + Branches + 2/60 +
+
+ 13.04% + Functions + 3/23 +
+
+ 17.36% + Lines + 21/121 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  + + +  + +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  + +  +  + +  + +  + +  +  +  + +  +  + +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  + + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var mongoose = require('mongoose'),
+	Schema = mongoose.Schema,
+	pdfFiller = require('pdffiller'),
+	_ = require('lodash'),
+	config = require('../../config/config'),
+	path = require('path'),
+	mUtilities = require('mongoose-utilities'),
+	fs = require('fs-extra'),
+	async = require('async'),
+	util = require('util');
+ 
+//Mongoose Models
+var FieldSchema = require('./form_field.server.model.js');
+var Field = mongoose.model('Field');
+ 
+var FormSubmissionSchema = require('./form_submission.server.model.js'),
+	FormSubmission = mongoose.model('FormSubmission', FormSubmissionSchema);
+ 
+ 
+var ButtonSchema = new Schema({
+	url: {
+		type: String,
+		match: [/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/],
+	},
+	action: String,
+	text: String,
+	bgColor: {
+		type: String,
+		match: [/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/],
+		default: '#5bc0de'
+	},
+	color: {
+		type: String,
+		match: [/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/],
+		default: '#ffffff'
+	}
+});
+ 
+/**
+ * Form Schema
+ */
+var FormSchema = new Schema({
+	title: {
+		type: String,
+		trim: true,
+		required: 'Form Title cannot be blank',
+	},
+	language: {
+		type: String,
+		enum: ['english', 'french', 'spanish'],
+		required: 'Form must have a language',
+		default: 'english'
+	},
+	description: {
+		type: String,
+		default: '',
+	},
+	form_fields: {
+		type: [FieldSchema],
+	},
+ 
+	submissions: [{
+		type: Schema.Types.ObjectId,
+		ref: 'FormSubmission'
+	}],
+ 
+	admin: {
+		type: Schema.Types.ObjectId,
+		ref: 'User',
+		required: 'Form must have an Admin'
+	},
+ 
+	pdf: {
+		type: Schema.Types.Mixed
+	},
+	pdfFieldMap: {
+		type: Schema.Types.Mixed
+	},
+ 
+	startPage: {
+		showStart:{
+			type: Boolean,
+			default: false,
+		},
+		introTitle:{
+			type: String,
+			default: 'Welcome to Form'
+		},
+		introParagraph:{
+			type: String,
+		},
+		buttons:[ButtonSchema]
+	},
+ 
+	hideFooter: {
+		type: Boolean,
+		default: false,
+	},
+	isGenerated: {
+		type: Boolean,
+		default: false,
+	},
+	isLive: {
+		type: Boolean,
+		default: false,
+	},
+	autofillPDFs: {
+		type: Boolean,
+		default: false,
+	},
+ 
+	design: {
+		colors:{
+			backgroundColor: { 
+				type: String,
+				match: [/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/],
+				default: '#fff'
+			},
+			questionColor: { 
+				type: String,
+				match: [/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/],
+				default: '#333',
+			},
+			answerColor: { 
+				type: String,
+				match: [/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/],
+				default: '#333',
+			},
+			buttonColor: { 
+				type: String,
+				match: [/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/]
+			},
+		},
+		font: String,
+		backgroundImage: { type: Schema.Types.Mixed }
+	},
+ 
+	plugins: {
+		oscarhost: {
+			baseUrl: {
+				type: String,
+			},
+			settings: {
+				lookupField: {
+					type: Schema.Types.ObjectId,
+					ref: 'Field'
+				},
+				updateType: {
+					type: String,
+					enum: ['upsert', 'force_add', 'force_update', 'fetch'],
+				},
+				fieldMap: {
+					type: Schema.Types.Mixed,
+				},
+				validUpdateTypes: {
+					type: [String]
+				},
+				validFields : {
+					type: [String],
+					default: [
+						'address',
+						'city',
+						'email',
+						'firstName',
+						'hin',
+						'lastName',
+						'phone',
+						'postal',
+						'province',
+						'sex',
+						'spokenLanguage',
+						'title',
+						'DOB']
+				}
+			},
+			auth: {
+				user: {
+					type: String,
+				},
+				pass: {
+					type: String,
+				}
+			}
+		}
+	}
+});
+ 
+FormSchema.plugin(mUtilities.timestamp, {
+	createdPath: 'created',
+	modifiedPath: 'lastModified',
+	useVirtual: false
+});
+FormSchema.pre('init', function (next) {
+	var validUpdateTypes= mongoose.model('Form').schema.path('plugins.oscarhost.settings.updateType').enumValues;
+	this.plugins.oscarhost.settings.validUpdateTypes = validUpdateTypes;
+ 
+	// this.plugins.oscarhost.settings.validFields = [
+	// 	'address',
+	// 	'city',
+	// 	'email',
+	// 	'firstName',
+	// 	'hin',
+	// 	'lastName',
+	// 	'phone',
+	// 	'postal',
+	// 	'province',
+	// 	'sex',
+	// 	'spokenLanguage',
+	// 	'title',
+	// 	'DOB'];
+	next();
+});
+//Delete template PDF of current Form
+FormSchema.pre('remove', function (next) {
+	if(this.pdf && process.env.NODE_ENV === 'development'){
+		//Delete template form
+		fs.unlink(this.pdf.path, function(err){
+			if (err) throw err;
+		  	console.log('successfully deleted', this.pdf.path);
+		});
+	}
+});
+ 
+var _original;
+ 
+//Set _original
+FormSchema.pre('save', function (next) {
+ 
+	this.constructor
+      .findOne({_id: this._id}).exec(function(err, original){
+      	Iif(err) {
+      		console.log(err);
+      		next(err);
+        } else {
+        	_original = original;
+        	//console.log('_original');
+        	// console.log(_original);
+        	next();
+        }
+    });
+});
+ 
+function getDeletedIndexes(needle, haystack){
+	var deletedIndexes = [];
+ 
+	if(haystack.length > 0){
+	  	for(var i = 0; i < needle.length; i++){
+	    	if(haystack.indexOf(needle[i]) === -1){
+				deletedIndexes.push(i);
+	    	}
+	  	}
+	}
+	return deletedIndexes;
+}
+ 
+//Move PDF to permanent location after new template is uploaded
+FormSchema.pre('save', function (next) {
+	Iif(this.pdf){
+		var that = this;
+		async.series([
+			function(callback){
+				if(that.isModified('pdf') && that.pdf.path){
+ 
+					var new_filename = that.title.replace(/ /g,'')+'_template.pdf';
+ 
+				    var newDestination = path.join(config.pdfUploadPath, that.admin.username.replace(/ /g,''), that.title.replace(/ /g,'')),
+				    	stat = null;
+ 
+				    try {
+				        stat = fs.statSync(newDestination);
+				    } catch (err) {
+				        fs.mkdirSync(newDestination);
+				    }
+				    if (stat && !stat.isDirectory()) {
+				        return callback( new Error('Directory cannot be created because an inode of a different type exists at "' + config.pdfUploadPath + '"'), null);
+				    }
+ 
+				    var old_path = that.pdf.path;
+				    fs.move(old_path, path.join(newDestination, new_filename), {clobber: true}, function (err) {
+						if (err) {
+							console.error(err);
+							callback( new Error(err.message), 'task1');
+						}else {
+							that.pdf.path = path.join(newDestination, new_filename);
+							that.pdf.name = new_filename;
+ 
+							callback(null,'task1');
+						}
+					});
+				}else {
+					callback(null,'task1');
+				}
+ 
+			},
+			function(callback){
+				if(that.isGenerated){
+					that.pdf.path = path.join(config.pdfUploadPath, that.admin.username.replace(/ /g,''), that.title.replace(/ /g,''), that.title.replace(/ /g,'')+'_template.pdf');
+					that.pdf.name = that.title.replace(/ /g,'')+'_template.pdf';
+					var _typeConvMap = {
+						'Multiline': 'textarea',
+						'Text': 'textfield',
+						'Button': 'checkbox',
+						'Choice': 'radio',
+						'Password': 'password',
+						'FileSelect': 'filefield',
+						'Radio': 'radio'
+					};
+ 
+					// console.log('autogenerating form');
+					// console.log(that.pdf.path);
+ 
+					pdfFiller.generateFieldJson(that.pdf.path, function(err, _form_fields){
+						if(err){
+							callback( new Error(err.message), null);
+						}else if(!_form_fields.length || _form_fields === undefined || _form_fields === null){
+							callback( new Error('Generated formfields is empty'), null);
+						}
+ 
+						//Map PDF field names to FormField field names
+						for(var i = 0; i < _form_fields.length; i++){
+							var field = _form_fields[i];
+ 
+							//Convert types from FDF to 'FormField' types
+							if(_typeConvMap[ field.fieldType+'' ]){
+								field.fieldType = _typeConvMap[ field.fieldType+'' ];
+							}
+ 
+							// field = new Field(field);
+							field.required = false;
+							_form_fields[i] = field;
+						}
+ 
+						// console.log('NEW FORM_FIELDS: ');
+						// console.log(_form_fields);
+ 
+						that.form_fields = that.form_fields.concat(_form_fields);
+ 
+						// console.log('\n\nOLD FORM_FIELDS: ');
+						// console.log(that.form_fields);
+						that.isGenerated = false;
+						callback(null, 'task2');
+					});
+				}else{
+					callback(null, 'task2');
+				}
+			}
+		], function(err, results) {
+			if(err){
+				next(new Error({
+					message: err.message
+				}));
+			}
+			console.log('ending form save');
+			next();
+ 
+		});
+	}else if(_original.hasOwnProperty('pdf')){
+		fs.remove(_original.pdf.path, function (err) {
+			if(err) next(err);
+			console.log('file at '+_original.pdf.path+' successfully deleted');
+			next();
+		});
+	}
+	next();
+});
+ 
+FormSchema.pre('save', function (next) {
+ 
+	// console.log('_original\n------------');
+	// console.log(_original);
+	//console.log('field has been deleted: ');
+	//console.log(this.isModified('form_fields') && !!this.form_fields && !!_original);
+ 
+	if(this.isModified('form_fields') && this.form_fields.length >= 0 && _original){
+ 
+		var old_form_fields = _original.form_fields,
+			new_ids = _.map(_.pluck(this.form_fields, '_id'), function(id){ return ''+id;}),
+			old_ids = _.map(_.pluck(old_form_fields, '_id'), function(id){ return ''+id;}),
+			deletedIds = getDeletedIndexes(old_ids, new_ids),
+			that = this;
+ 
+		// console.log('deletedId Indexes\n--------');
+		// console.log(deletedIds);
+		// console.log('old_ids\n--------');
+		// console.log(old_ids);
+		// console.log('new_ids\n--------');
+		// console.log(new_ids);
+ 
+		//Preserve fields that have at least one submission
+		if( deletedIds.length > 0 ){
+ 
+			var modifiedSubmissions = [];
+ 
+			async.forEachOfSeries(deletedIds, 
+				function (deletedIdIndex, key, callback) {
+					
+					var deleted_id = old_ids[deletedIdIndex];
+ 
+					//Find FormSubmissions that contain field with _id equal to 'deleted_id'
+					FormSubmission.
+						find({ form: that._id, admin: that.admin, form_fields: {$elemMatch: {_id: deleted_id} }  }).
+						exec(function(err, submissions){
+							if(err){
+								console.error(err);
+								return callback(err);
+							}
+ 
+							//Delete field if there are no submission(s) found
+							if(submissions.length) {
+								// console.log('adding submissions');
+								// console.log(submissions);
+								//Add submissions 
+								modifiedSubmissions.push.apply(modifiedSubmissions, submissions);
+							}
+ 
+							callback(null);
+						});
+					// }
+				}, 
+				function (err) {
+					if(err){
+						console.error(err.message);
+						next(err);
+					}
+ 
+					// console.log('modifiedSubmissions\n---------\n\n');
+					// console.log(modifiedSubmissions);
+ 
+					//Iterate through all submissions with modified form_fields
+					async.forEachOfSeries(modifiedSubmissions, function (submission, key, callback) {
+ 
+						//Iterate through ids of deleted fields
+						for(var i = 0; i < deletedIds.length; i++){
+ 
+							//Get index of deleted field
+							var index = _.findIndex(submission.form_fields, function(field) { 
+								var tmp_id = field._id+'';
+								return tmp_id === old_ids[ deletedIds[i] ];
+							});
+ 
+							var deletedField = submission.form_fields[index];
+ 
+							//Hide field if it exists
+							if(deletedField){
+								// console.log('deletedField\n-------\n\n');
+								// console.log(deletedField);
+								//Delete old form_field
+								submission.form_fields.splice(index, 1);
+ 
+								deletedField.deletePreserved = true;
+ 
+								//Move deleted form_field to start
+								submission.form_fields.unshift(deletedField);
+								that.form_fields.unshift(deletedField);
+								// console.log('form.form_fields\n--------\n\n');
+								// console.log(that.form_fields);
+							}
+						}
+ 
+						submission.save(function (err) {
+						  	if(err) callback(err);
+							else callback(null);
+						});	
+					}, function (err) {
+						if(err){
+							console.error(err.message);
+							next(err);
+						}
+						// console.log('form.form_fields\n--------\n\n');
+						// console.log(that.form_fields);
+						next();
+					});
+				}
+			);
+		}else {
+			next();
+		}
+	}else {
+		next();
+	}
+});
+ 
+ 
+mongoose.model('Form', FormSchema);
+ 
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/models/form_field.server.model.js.html b/coverageServer/lcov-report/kiosk_form/app/models/form_field.server.model.js.html new file mode 100644 index 00000000..6bb6cd8c --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/models/form_field.server.model.js.html @@ -0,0 +1,386 @@ + + + + Code coverage report for kiosk_form/app/models/form_field.server.model.js + + + + + + + +
+
+

+ all files / kiosk_form/app/models/ form_field.server.model.js +

+
+
+ 100% + Statements + 9/9 +
+
+ 100% + Branches + 0/0 +
+
+ 100% + Functions + 1/1 +
+
+ 100% + Lines + 9/9 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108  +  +  +  +  + +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  + + + +  +  +  + +  + +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var mongoose = require('mongoose'),
+	mUtilities = require('mongoose-utilities'),
+	_ = require('lodash'),
+	Schema = mongoose.Schema;
+ 
+var FieldOptionSchema = new Schema({
+	option_id: {
+		type: Number,
+	},
+ 
+	option_title: {
+		type: String,
+	},
+ 
+	option_value: {
+		type: String,
+		trim: true,
+	},
+});
+ 
+ 
+/**
+ * FormField Schema
+ */
+var FormFieldSchema = new Schema({
+	title: {
+		type: String,
+		trim: true,
+		required: 'Field Title cannot be blank',
+	},
+	description: {
+		type: String,
+		default: '',
+	},
+ 
+	logicJump: {
+		type: Schema.Types.ObjectId,
+		ref: 'LogicJump'
+	},
+ 
+	fieldOptions: [FieldOptionSchema],
+	required: {
+		type: Boolean,
+		default: true,
+	},
+	disabled: {
+		type: Boolean,
+		default: false,
+	},
+ 
+	deletePreserved: {
+		type: Boolean,
+		default: false
+	},
+	validFieldTypes: {
+		type: [String]
+	},
+	fieldType: {
+		type: String,
+		required: true,
+		enum: [
+		    'textfield',
+		    'date',
+		    'email',
+		    'link',
+		    'legal',
+		    'url',
+		    'textarea',
+		    'statement',
+		    'welcome',
+		    'thankyou',
+		    'file',
+		    'dropdown',
+		    'scale',
+		    'rating',
+		    'radio',
+		    'checkbox',
+		    'hidden',
+		    'yes_no',
+		    'natural',
+		    'number'
+		],
+	},
+	fieldValue: Schema.Types.Mixed
+});
+ 
+FormFieldSchema.plugin(mUtilities.timestamp, {
+	createdPath: 'created',
+	modifiedPath: 'lastModified',
+	useVirtual: false
+});
+ 
+FormFieldSchema.pre('save', function (next){
+	this.validFieldTypes = mongoose.model('Field').schema.path('fieldType').enumValues;
+	next();
+});
+ 
+ 
+mongoose.model('Field', FormFieldSchema);
+ 
+module.exports = FormFieldSchema;
+ 
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/models/form_submission.server.model.js.html b/coverageServer/lcov-report/kiosk_form/app/models/form_submission.server.model.js.html new file mode 100644 index 00000000..4dbdcc55 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/models/form_submission.server.model.js.html @@ -0,0 +1,896 @@ + + + + Code coverage report for kiosk_form/app/models/form_submission.server.model.js + + + + + + + +
+
+

+ all files / kiosk_form/app/models/ form_submission.server.model.js +

+
+
+ 9.52% + Statements + 8/84 +
+
+ 0% + Branches + 0/35 +
+
+ 0% + Functions + 0/15 +
+
+ 10.26% + Lines + 8/78 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var mongoose = require('mongoose'),
+	Schema = mongoose.Schema,
+	pdfFiller = require('pdffiller'),
+	freegeoip = require('node-freegeoip'),
+	_ = require('lodash'),
+	config = require('../../config/config'),
+	path = require('path'),
+	fs = require('fs-extra'),
+	mUtilities = require('mongoose-utilities'),
+	soap = require('soap'),
+	async = require('async'),
+	FieldSchema = require('./form_field.server.model.js'),
+	OscarSecurity = require('../../scripts/oscarhost/OscarSecurity');
+ 
+var newDemoTemplate = { 
+	address: '880-9650 Velit. St.',
+	city: '',
+	dateOfBirth: '10',
+	displayName: 'LITTLE, URIAH',
+	email: '',
+	firstName: 'Uriah F.',
+	hin: '',
+	lastName: 'Little',
+	lastUpdateDate: Date.now(),
+	monthOfBirth: '05',
+	officialLanguage: 'English',
+	phone: '250-',
+	phone2: '',
+	postal: 'S4M 7T8',
+	province: 'BC',
+	sex: 'F',
+	sexDesc: 'Female',
+	sin: '',
+	spokenLanguage: 'English',
+	title: 'MS.',
+	yearOfBirth: '2015' 
+};
+ 
+/** 
+ * Form Submission Schema
+ */
+var FormSubmissionSchema = new Schema({
+	title: {
+		type: String
+	},
+ 
+	admin: {
+		type: Schema.Types.ObjectId,
+		ref: 'User',
+		required: true
+	},
+ 
+	form_fields: {
+		type: [Schema.Types.Mixed],
+	},
+ 
+	form: { 
+		type: Schema.Types.ObjectId, 
+		ref: 'Form', 
+		required: true
+	},
+ 
+	ipAddr: {
+		type: String,
+	},
+	geoLocation: {
+		Country: {
+			type: String,
+		},
+		Region: {
+			type: String,
+		},
+		City: {
+			type: String,
+		}
+	},
+	device: {
+		type: {
+			type: String,
+		},
+		name: {
+			type: String,
+		}
+	},
+ 
+	pdfFilePath: {
+		type: Schema.Types.Mixed,
+	},
+	pdf: {
+		type: Schema.Types.Mixed,
+	},
+	fdfData: {
+		type: Schema.Types.Mixed,
+	},
+ 
+	timeElapsed: { 
+		type: Number,
+	}, 
+	percentageComplete: {
+		type: Number,
+	},
+ 
+	//TODO: DAVID: Need to not have this hardcoded
+	oscarDemoNum: {
+		type: Number,
+	},
+ 
+	hasPlugins: {
+		oscarhost: {
+			type: Boolean,
+			default: false,
+		}
+	}
+ 
+});
+ 
+FormSubmissionSchema.plugin(mUtilities.timestamp, {
+	createdPath: 'created',
+	modifiedPath: 'lastModified',
+	useVirtual: false
+});
+ 
+//Oscarhost API hook
+FormSubmissionSchema.pre('save', function (next) {
+	
+	var self = this;
+ 
+	if(this.hasPlugins.oscarhost){
+		mongoose.model('Form').findById(self.form, function(err, _form){
+			var form_ids = _.map(_.pluck(_form.form_fields, '_id'), function(id){ return ''+id;}),
+				submission_ids = _.pluck(self.form_fields, '_id');
+ 
+			// console.log('Form form_field ids\n--------');
+			// console.log(form_ids);
+			// console.log('FormSubmission [form_field ids]\n--------');
+			// console.log(submission_ids);
+ 
+			if(err) next(err);
+			// console.log(_form);
+			// console.log('should push to api');
+			// console.log( (!this.oscarDemoNum && !!_form.plugins.oscarhost.baseUrl && !!_form.plugins.oscarhost.settings.fieldMap) );
+			if(!this.oscarDemoNum && _form.plugins.oscarhost.baseUrl && _form.plugins.oscarhost.settings.fieldMap){
+				console.log('OSCARHOST API HOOK');
+		 		var url_login = _form.plugins.oscarhost.baseUrl+'/LoginService?wsdl',
+		 			url_demo = _form.plugins.oscarhost.baseUrl+'/DemographicService?wsdl';
+ 
+		 		var args_login = {arg0: config.oscarhost.auth.user, arg1: config.oscarhost.auth.pass};
+ 
+		 		var options = {
+		 		    ignoredNamespaces: {
+		 		        namespaces: ['targetNamespace', 'typedNamespace'],
+		 		        override: true
+		 		    }
+		 		};
+		 		// console.log(self.form_fields);
+ 
+		 		//Generate demographics from hashmap
+		 		var generateDemo = function(formFields, conversionMap, demographicsTemplate){
+		 			console.log('generating Demo fields');
+		 			console.log(conversionMap);
+		 			var _generatedDemo = {}, currField, propertyName;
+ 
+		 			for(var y=0; y<formFields.length; y++){
+		 				currField = formFields[y];
+		 				propertyName = conversionMap[currField._id];
+ 
+		 				if(demographicsTemplate.hasOwnProperty(conversionMap[currField._id])){
+		 					_generatedDemo[propertyName] = currField.fieldValue+'';
+		 				}else if(propertyName === 'DOB'){
+	 						var date = new Date(currField.fieldValue);
+	 						_generatedDemo.dateOfBirth = date.getDate()+'';
+	 						_generatedDemo.yearOfBirth = date.getFullYear()+'';
+	 						_generatedDemo.monthOfBirth = date.getMonth()+'';			
+		 				}
+		 			}
+		 			var currDate = new Date();
+		 			var dateString = currDate.toISOString().split('T')[0] + ' ' + currDate.toISOString().split('T')[1].slice(0,8);
+		 			_generatedDemo.lastUpdateDate = currDate.toISOString();
+		 			return _generatedDemo;
+		 		};
+		 		
+		 		var submissionDemographic = generateDemo(self.form_fields, _form.plugins.oscarhost.settings.fieldMap, newDemoTemplate);
+ 
+		 		console.log(submissionDemographic);
+				async.waterfall([
+					function (callback) {	
+						//Authenticate with API
+						soap.createClient(url_login, options, function(err, client) {
+							client.login(args_login, function (err, result) {
+								if(err) callback(err);
+								console.log('SOAP authenticated');
+								callback(null, result.return);
+							});
+						});
+					},
+ 
+					function (security_obj, callback) {
+						//Force Add Demographic
+						if(_form.plugins.oscarhost.settings.updateType === 'force_add'){
+							soap.createClient(url_demo, options, function(err, client) {
+								client.setSecurity(new OscarSecurity(security_obj.securityId, security_obj.securityTokenKey) );
+ 
+								client.addDemographic({ arg0: submissionDemographic }, function (err, result) {
+									console.log('FORCE ADDING DEMOGRAPHIC \n');
+									// console.log(result.return);
+									if(err) callback(err);
+									callback(null, result);
+								});
+							});
+						}
+					},
+ 
+				], function(err, result) {
+					if(err) next(err);
+ 
+					self.oscarDemoNum = parseInt(result.return, 10);
+					console.log('self.oscarDemoNum: '+self.oscarDemoNum);
+					next();
+				});	
+			}else{
+				next();
+			}
+		});
+	}else{
+		next();
+	}
+ 
+});
+ 
+//Check for IP Address of submitting person 
+FormSubmissionSchema.pre('save', function (next){
+	var self = this;
+	if(this.ipAddr){
+		if(this.isModified('ipAddr') || !this.geoLocation){
+			freegeoip.getLocation(this.ipAddr, function(err, location){
+				if(err) next(err);
+				self.geoLocation = JSON.parse(location);
+				next();
+			});
+		}
+	}
+	next();
+});
+ 
+//Generate autofilled PDF if flags are set 
+FormSubmissionSchema.pre('save', function (next) {
+	var fdfData, dest_filename, dest_path,
+		self = this,
+		_form = this.form;
+	
+ 
+	if(this.pdf && this.pdf.path){
+		dest_filename = self.title.replace(/ /g,'')+'_submission_'+Date.now()+'.pdf';
+		var __path = this.pdf.path.split('/').slice(0,this.pdf.path.split('/').length-1).join('/');
+		dest_path = path.join(__path, dest_filename);
+ 
+		self.pdfFilePath = dest_path;
+ 
+		pdfFiller.fillForm(self.pdf.path, dest_path, self.fdfData, function(err){
+			if(err) {
+				console.log('\n err.message: '+err.message);
+				next( new Error(err.message) );
+			}
+			console.log('Field data from Form: '+self.title.replace(/ /g,'')+' outputed to new PDF: '+dest_path);
+			next();
+		});
+	} else {
+		next();
+	}
+});
+ 
+module.exports = FormSubmissionSchema;
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/models/index.html b/coverageServer/lcov-report/kiosk_form/app/models/index.html new file mode 100644 index 00000000..e2c3c81f --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/models/index.html @@ -0,0 +1,145 @@ + + + + Code coverage report for kiosk_form/app/models/ + + + + + + + +
+
+

+ all files kiosk_form/app/models/ +

+
+
+ 25.78% + Statements + 74/287 +
+
+ 11.02% + Branches + 14/127 +
+
+ 18.87% + Functions + 10/53 +
+
+ 26.62% + Lines + 74/278 +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
form.server.model.js
16.94%21/1243.33%2/6013.04%3/2317.36%21/121
form_field.server.model.js
100%9/9100%0/0100%1/1100%9/9
form_submission.server.model.js
9.52%8/840%0/350%0/1510.26%8/78
logic_jump.server.model.js
25%6/240%0/60%0/325%6/24
user.server.model.js
65.22%30/4646.15%12/2654.55%6/1165.22%30/46
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/models/logic_jump.server.model.js.html b/coverageServer/lcov-report/kiosk_form/app/models/logic_jump.server.model.js.html new file mode 100644 index 00000000..3ff6c796 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/models/logic_jump.server.model.js.html @@ -0,0 +1,299 @@ + + + + Code coverage report for kiosk_form/app/models/logic_jump.server.model.js + + + + + + + +
+
+

+ all files / kiosk_form/app/models/ logic_jump.server.model.js +

+
+
+ 25% + Statements + 6/24 +
+
+ 0% + Branches + 0/6 +
+
+ 0% + Functions + 0/3 +
+
+ 25% + Lines + 6/24 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79  +  +  +  +  + +  +  +  +  +  + +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var mongoose = require('mongoose'),
+	Schema = mongoose.Schema,
+	_ = require('lodash'),
+	math = require('math');
+ 
+ 
+var BooleanExpressionSchema = new Schema({
+	expressionString: {
+		type: String,
+	},
+	result: {
+		type: Boolean,
+	}
+});
+ 
+ 
+BooleanExpressionSchema.methods.evaluate = function(){
+ 
+	//Get headNode
+	var headNode = math.parse(expressionString);
+	var expressionScope = {};
+	var that = this;
+ 
+	//Create scope
+	headNode.traverse(function (node, path, parent) {
+		if(node.type === 'SymbolNode'){
+ 
+			mongoose.model('Field')
+				.findOne({_id: node.name}).exec(function(err, field){
+					if(err) {
+						console.log(err);
+						throw new Error(err);
+					} 
+ 
+					if(!!_.parseInt(field.fieldValue)){
+						that.expressionScope[node.name] = _.parseInt(field.fieldValue);
+					}else {
+						that.expressionScope[node.name] = field.fieldValue;						
+					}
+					console.log('_id: '+node.name);
+					console.log('value: '+that.expressionScope[node.name]);
+		    });
+		}
+	});
+ 
+	var code = headNode.compile(); 
+	var result = code.eval(expressionScope);
+ 
+	this.result = result;
+	return result;
+};
+ 
+mongoose.model('BooleanExpression', BooleanExpressionSchema);
+/**
+ * Form Schema
+ */
+var LogicJumpSchema = new Schema({
+	created: {
+		type: Date,
+		default: Date.now
+	},
+	lastModified: {
+		type: Date,
+	},
+ 
+	BooleanExpression: {
+		type: Schema.Types.ObjectId,
+		ref: 'BooleanExpression'
+	},
+ 
+});
+ 
+mongoose.model('LogicJump', LogicJumpSchema);
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/models/user.server.model.js.html b/coverageServer/lcov-report/kiosk_form/app/models/user.server.model.js.html new file mode 100644 index 00000000..99c26d92 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/models/user.server.model.js.html @@ -0,0 +1,665 @@ + + + + Code coverage report for kiosk_form/app/models/user.server.model.js + + + + + + + +
+
+

+ all files / kiosk_form/app/models/ user.server.model.js +

+
+
+ 65.22% + Statements + 30/46 +
+
+ 46.15% + Branches + 12/26 +
+
+ 54.55% + Functions + 6/11 +
+
+ 65.22% + Lines + 30/46 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  + +32× +  +  +  +  +  + +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  + +  +  +  +  +  +  + + + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  + +15× +  + +  +  +  +  +  +  +  + +  +15× +15× +  +  +15× +15× +  +  +  +  +  +  +  +  + +  +  +  +  +  +  + + + +  + +  +  + + + +  + +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  + + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var mongoose = require('mongoose'),
+	Schema = mongoose.Schema,
+	crypto = require('crypto'),
+	config = require('../../config/config'),
+	fs = require('fs-extra'),
+	mUtilities = require('mongoose-utilities'),
+	path = require('path');
+ 
+/**
+ * A Validation function for local strategy properties
+ */
+var validateLocalStrategyProperty = function(property) {
+	return ((this.provider !== 'local' && !this.updated) || property.length);
+};
+ 
+/**
+ * A Validation function for local strategy password
+ */
+var validateLocalStrategyPassword = function(password) {
+	return (this.provider !== 'local' || (password && password.length > 6));
+};
+ 
+/**
+ * User Schema
+ */
+var UserSchema = new Schema({
+	firstName: {
+		type: String,
+		trim: true,
+		default: '',
+		validate: [validateLocalStrategyProperty, 'Please fill in your first name']
+	},
+	lastName: {
+		type: String,
+		trim: true,
+		default: '',
+		validate: [validateLocalStrategyProperty, 'Please fill in your last name']
+	},
+	email: {
+		type: String,
+		trim: true,
+		unique: 'Account already exists with this email',
+		required: 'Please enter your email',
+		validate: [validateLocalStrategyProperty, 'Please fill in your email'],
+		match: [/.+\@.+\..+/, 'Please fill a valid email address']
+	},
+	username: {
+		type: String,
+		unique: true,
+		required: false,
+		trim: true
+	},
+	passwordHash: {
+		type: String,
+		default: '',
+	},
+	salt: {
+		type: String
+	},
+	provider: {
+		type: String,
+		required: 'Provider is required'
+	},
+	providerData: {},
+	additionalProvidersData: {},
+	roles: {
+		type: [{
+			type: String,
+			enum: ['user', 'admin', 'superuser']
+		}],
+		default: ['user']
+	},
+	language: {
+		type: String,
+		enum: ['english', 'french', 'spanish'],
+		default: 'english',
+		required: 'User must have a language'
+	},
+	lastModified: {
+		type: Date
+	},
+	created: {
+		type: Date,
+		default: Date.now
+	},
+ 
+	/* For reset password */
+	resetPasswordToken: {
+		type: String
+	},
+	resetPasswordExpires: {
+		type: Date
+	},
+	token: String
+});
+ 
+UserSchema.virtual('displayName').get(function () {
+  	return this.firstName + ' ' + this.lastName;
+});
+ 
+UserSchema.plugin(mUtilities.timestamp, {
+	createdPath: 'created',
+	modifiedPath: 'lastModified',
+	useVirtual: false
+});
+ 
+//Create folder for user's pdfs
+UserSchema.pre('save', function (next) {
+	this.username = this.email;
+	Iif(process.env.NODE_ENV === 'development'){
+		var newDestination = path.join(config.pdfUploadPath, this.username.replace(/ /g,'')),
+			stat = null;
+ 
+		try {
+	        stat = fs.statSync(newDestination);
+	    } catch (err) {
+	        fs.mkdirSync(newDestination);
+	    }
+	    if (stat && !stat.isDirectory()) {
+	    	// console.log('Directory cannot be created');
+	        next( new Error('Directory cannot be created because an inode of a different type exists at "' + newDestination + '"') );
+	    }else{
+	    	next();
+	    }
+	}	
+    next();
+});
+ 
+/**
+ * Hook a pre save method to hash the password
+ */
+UserSchema.virtual('password').set(function (password) {
+  this.passwordHash = this.hashPassword(password);
+});
+UserSchema.virtual('password').get(function () {
+  return this.passwordHash;
+});
+ 
+ 
+/**
+ * Create instance method for hashing a password
+ */
+UserSchema.methods.hashPassword = function(password) {
+	//Generate salt if it doesn't exist yet
+	Eif(!this.salt){
+		this.salt = crypto.randomBytes(64).toString('base64');
+	}
+ 
+	Eif (password) {
+		return crypto.pbkdf2Sync(password, new Buffer(this.salt, 'base64'), 10000, 128).toString('base64');
+	} else {
+		return password;
+	}
+};
+ 
+/**
+ * Create instance method for authenticating user
+ */
+UserSchema.methods.authenticate = function(password) {
+	return this.password === this.hashPassword(password);
+};
+ 
+/**
+ * Find possible not used username
+ */
+UserSchema.statics.findUniqueUsername = function(username, suffix, callback) {
+	var _this = this;
+	var possibleUsername = username + (suffix || '');
+ 
+	_this.findOne({
+		username: possibleUsername
+	}, function(err, user) {
+		Eif (!err) {
+			if (!user) {
+				callback(possibleUsername);
+			} else {
+				return _this.findUniqueUsername(username, (suffix || 0) + 1, callback);
+			}
+		} else {
+			callback(null);
+		}
+	});
+};
+ 
+/**
+ * Function to check if user has Admin priviledges
+ */
+UserSchema.methods.isAdmin = function() {
+	if(this.roles.indexOf('admin') !== -1){
+		return true;
+	}
+	return false;
+};
+ 
+module.exports = mongoose.model('User', UserSchema);
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/routes/core.server.routes.js.html b/coverageServer/lcov-report/kiosk_form/app/routes/core.server.routes.js.html new file mode 100644 index 00000000..c189b524 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/routes/core.server.routes.js.html @@ -0,0 +1,86 @@ + + + + Code coverage report for kiosk_form/app/routes/core.server.routes.js + + + + + + + +
+
+

+ all files / kiosk_form/app/routes/ core.server.routes.js +

+
+
+ 100% + Statements + 3/3 +
+
+ 100% + Branches + 0/0 +
+
+ 100% + Functions + 1/1 +
+
+ 100% + Lines + 3/3 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8  +  + +  + + +  + 
'use strict';
+ 
+module.exports = function(app) {
+	// Root routing
+	var core = require('../../app/controllers/core.server.controller');
+	app.route('/').get(core.index);
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/routes/forms.server.routes.js.html b/coverageServer/lcov-report/kiosk_form/app/routes/forms.server.routes.js.html new file mode 100644 index 00000000..ab58a44e --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/routes/forms.server.routes.js.html @@ -0,0 +1,203 @@ + + + + Code coverage report for kiosk_form/app/routes/forms.server.routes.js + + + + + + + +
+
+

+ all files / kiosk_form/app/routes/ forms.server.routes.js +

+
+
+ 72.73% + Statements + 8/11 +
+
+ 100% + Branches + 0/0 +
+
+ 25% + Functions + 1/4 +
+
+ 72.73% + Lines + 8/11 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47  +  +  +  +  + +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  + +  + +  +  + +  +  +  + +  +  +  +  +  + +  +  +  +  + +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var users = require('../../app/controllers/users.server.controller'),
+	forms = require('../../app/controllers/forms.server.controller'),
+	multer = require('multer'),
+	config = require('../../config/config');
+ 
+// Setting the pdf upload route and folder
+var upload = multer({ dest: config.tmpUploadPath,
+		rename: function (fieldname, filename) {
+		    return Date.now();
+		},
+		onFileUploadStart: function (file) {
+			//Check to make sure we can only upload images and pdfs
+		  	console.log(file.originalname + ' is starting ...');
+		},
+		onFileUploadComplete: function (file, req, res) {
+			console.log(file.originalname + ' uploaded to  ' + file.path);
+		}
+	});
+ 
+module.exports = function(app) {
+	// Form Routes
+	app.route('/upload/pdf')
+		.post(users.requiresLogin, upload.single('file'), forms.uploadPDF);
+ 
+	app.route('/forms')
+		.get(users.requiresLogin, forms.list)
+		.post(users.requiresLogin, forms.create);
+ 
+	app.route('/forms/:formId([a-zA-Z0-9]+)')
+		.get(forms.read)
+		.post(forms.createSubmission)
+		.put(users.requiresLogin, forms.hasAuthorization, forms.update)
+		.delete(users.requiresLogin, forms.hasAuthorization, forms.delete);
+ 
+	app.route('/forms/:formId([a-zA-Z0-9]+)/submissions')
+		.get(forms.listSubmissions, users.requiresLogin, forms.hasAuthorization)
+		.delete(users.requiresLogin, forms.hasAuthorization, forms.deleteSubmissions);
+ 
+	// Finish by binding the form middleware
+	app.param('formId', forms.formByID);
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/routes/index.html b/coverageServer/lcov-report/kiosk_form/app/routes/index.html new file mode 100644 index 00000000..18329d1d --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/routes/index.html @@ -0,0 +1,119 @@ + + + + Code coverage report for kiosk_form/app/routes/ + + + + + + + +
+
+

+ all files kiosk_form/app/routes/ +

+
+
+ 90% + Statements + 27/30 +
+
+ 100% + Branches + 0/0 +
+
+ 50% + Functions + 3/6 +
+
+ 90% + Lines + 27/30 +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
core.server.routes.js
100%3/3100%0/0100%1/1100%3/3
forms.server.routes.js
72.73%8/11100%0/025%1/472.73%8/11
users.server.routes.js
100%16/16100%0/0100%1/1100%16/16
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/app/routes/users.server.routes.js.html b/coverageServer/lcov-report/kiosk_form/app/routes/users.server.routes.js.html new file mode 100644 index 00000000..1b3d8dd8 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/app/routes/users.server.routes.js.html @@ -0,0 +1,248 @@ + + + + Code coverage report for kiosk_form/app/routes/users.server.routes.js + + + + + + + +
+
+

+ all files / kiosk_form/app/routes/ users.server.routes.js +

+
+
+ 100% + Statements + 16/16 +
+
+ 100% + Branches + 0/0 +
+
+ 100% + Functions + 1/1 +
+
+ 100% + Lines + 16/16 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62  +  +  +  +  + +  + +  + +  +  + + + +  +  + + +  +  + + + + +  +  + + + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var passport = require('passport');
+ 
+module.exports = function(app) {
+	// User Routes
+	var users = require('../../app/controllers/users.server.controller');
+ 
+	// Setting up the users profile api
+	app.route('/users/me').get(users.requiresLogin, users.getUser);
+	app.route('/users').put(users.requiresLogin, users.update);
+	app.route('/users/accounts').delete(users.requiresLogin, users.removeOAuthProvider);
+ 
+	// Setting up the users account verification api
+	app.route('/auth/verify/:token').get(users.validateVerificationToken);
+	app.route('/auth/verify').post(users.resendVerificationEmail);
+ 
+	// Setting up the users password api
+	app.route('/users/password').post(users.requiresLogin, users.changePassword);
+	app.route('/auth/forgot').post(users.forgot);
+	app.route('/auth/reset/:token').get(users.validateResetToken);
+	app.route('/auth/reset/:token').post(users.reset);
+ 
+	// Setting up the users authentication api
+	app.route('/auth/signup').post(users.signup);
+	app.route('/auth/signin').post(users.signin);
+	app.route('/auth/signout').get(users.signout);
+ 
+	// // Setting the facebook oauth routes
+	// app.route('/auth/facebook').get(passport.authenticate('facebook', {
+	// 	scope: ['email']
+	// }));
+	// app.route('/auth/facebook/callback').get(users.oauthCallback('facebook'));
+ 
+	// // Setting the twitter oauth routes
+	// app.route('/auth/twitter').get(passport.authenticate('twitter'));
+	// app.route('/auth/twitter/callback').get(users.oauthCallback('twitter'));
+ 
+	// // Setting the google oauth routes
+	// app.route('/auth/google').get(passport.authenticate('google', {
+	// 	scope: [
+	// 		'https://www.googleapis.com/auth/userinfo.profile',
+	// 		'https://www.googleapis.com/auth/userinfo.email'
+	// 	]
+	// }));
+	// app.route('/auth/google/callback').get(users.oauthCallback('google'));
+ 
+	// // Setting the linkedin oauth routes
+	// app.route('/auth/linkedin').get(passport.authenticate('linkedin'));
+	// app.route('/auth/linkedin/callback').get(users.oauthCallback('linkedin'));
+ 
+	// // Setting the github oauth routes
+	// app.route('/auth/github').get(passport.authenticate('github'));
+	// app.route('/auth/github/callback').get(users.oauthCallback('github'));
+ 
+	// Finish by binding the user middleware
+	app.param('userId', users.userByID);
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/config/config.js.html b/coverageServer/lcov-report/kiosk_form/config/config.js.html new file mode 100644 index 00000000..c15c12ad --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/config/config.js.html @@ -0,0 +1,383 @@ + + + + Code coverage report for kiosk_form/config/config.js + + + + + + + +
+
+

+ all files / kiosk_form/config/ config.js +

+
+
+ 92.11% + Statements + 35/38 +
+
+ 64.29% + Branches + 9/14 +
+
+ 100% + Functions + 10/10 +
+
+ 92.11% + Lines + 35/38 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107  +  +  +  +  + +  +  +  +  +  +  +  +  + +  +  +  +  +  + + +  +  +  +  +  +  +  +  +  +  +  + +  +11× +  +  +11× +  +  +11× +  +  +11× + + +  + + +  +  + + + +44× +  +  +  + +  +  +  +11× +  +  + + +40× +  +  +  +  +  +  + + +  + + +  + + +  +  +  +  +  + + +  +  + +  +  +  + +  +  +  +  +  + + + +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var _ = require('lodash'),
+	glob = require('glob'),
+	bowerFiles = require('main-bower-files'),
+	path = require('path'),
+	fs = require('fs');
+ 
+/**
+ * Load app configurations
+ */
+ var exports = _.extend(
+		require('./env/all'),
+		require('./env/' + process.env.NODE_ENV) || {}
+	);
+ 
+//Load keys from api_keys.js if file exists
+Eif( fs.existsSync('./config/env/api_keys.js') ){
+	module.exports = _.extend(
+		exports,
+		require('./env/api_keys')
+	);
+}else {
+	module.exports = exports;
+}
+ 
+ 
+/**
+ * Get files by glob patterns
+ */
+module.exports.getGlobbedFiles = function(globPatterns, removeRoot) {
+	// For context switching
+	var _this = this;
+ 
+	// URL paths regex
+	var urlRegex = new RegExp('^(?:[a-z]+:)?\/\/', 'i');
+ 
+	// The output array
+	var output = [];
+ 
+	// If glob pattern is array so we use each pattern in a recursive way, otherwise we use glob
+	if (_.isArray(globPatterns)) {
+		globPatterns.forEach(function(globPattern) {
+			output = _.union(output, _this.getGlobbedFiles(globPattern, removeRoot));
+		});
+	} else Eif (_.isString(globPatterns)) {
+		Iif (urlRegex.test(globPatterns)) {
+			output.push(globPatterns);
+		} else {
+			var files = glob.sync(globPatterns)
+			if (removeRoot) {
+				files = files.map(function(file) {
+					return file.replace(removeRoot, '');
+				});
+			}
+ 
+			output = _.union(output, files);
+		}
+	}
+ 
+	return output;
+};
+ 
+module.exports.removeRootDir = function(files, root) {
+	return files.map(function(file) {
+		return file.replace(path.join(process.cwd(),root), '');
+	});
+};
+ 
+/**
+ * Get the app's bower dependencies
+ */
+module.exports.getBowerJSAssets = function() {
+	return this.removeRootDir(bowerFiles('**/**.js'), 'public/');
+};
+module.exports.getBowerCSSAssets = function() {
+	return this.removeRootDir(bowerFiles('**/**.css'), 'public/');
+};
+module.exports.getBowerOtherAssets = function() {
+	return this.removeRootDir(bowerFiles('**/!(*.js|*.css|*.less)'), 'public/');
+};
+ 
+/**
+ * Get the modules JavaScript files
+ */
+module.exports.getJavaScriptAssets = function(includeTests) {
+	var output = this.getGlobbedFiles(this.assets.js, 'public/');
+ 
+	// To include tests
+	Iif (includeTests) {
+		output = _.union(output, this.getGlobbedFiles(this.assets.tests));
+	}
+ 
+	return output;
+};
+ 
+/**
+ * Get the modules CSS files
+ */
+module.exports.getCSSAssets = function() {
+	var output = this.getGlobbedFiles(this.assets.css, 'public/');
+	return output;
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/config/env/all.js.html b/coverageServer/lcov-report/kiosk_form/config/env/all.js.html new file mode 100644 index 00000000..7830c490 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/config/env/all.js.html @@ -0,0 +1,338 @@ + + + + Code coverage report for kiosk_form/config/env/all.js + + + + + + + +
+
+

+ all files / kiosk_form/config/env/ all.js +

+
+
+ 100% + Statements + 1/1 +
+
+ 100% + Branches + 6/6 +
+
+ 100% + Functions + 0/0 +
+
+ 100% + Lines + 1/1 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + 
'use strict';
+ 
+module.exports = {
+	app: {
+		title: 'TellForm',
+		description: 'Opensource form builder alternative to TypeForm',
+		keywords: 'typeform, pdfs, forms, opensource, formbuilder, google forms, nodejs',
+	},
+	port: process.env.PORT || 3000,
+	templateEngine: 'swig',
+ 
+	baseUrl: '',
+	tempUserCollection: 'temporary_users',
+ 
+	mailosaur: {
+		key: process.env.MAILOSAUR_KEY || '',
+		mailbox_id: process.env.MAILOSAUR_MAILBOX || '',
+	},
+ 
+	//Sentry DSN Client Key
+	DSN: 'http://db01e03015ce48e2b68240ea8254b17c:5d878e9bb6c6488fbb70fb81295ee700@sentry.polydaic.com/1',
+ 
+	// The secret should be set to a non-guessable string that
+	// is used to compute a session hash
+	sessionSecret: 'MEAN',
+	// The name of the MongoDB collection to store sessions in
+	sessionCollection: 'sessions',
+	// The session cookie settings
+	sessionCookie: {
+		path: '/',
+		httpOnly: true,
+		// If secure is set to true then it will cause the cookie to be set
+		// only when SSL-enabled (HTTPS) is used, and otherwise it won't
+		// set a cookie. 'true' is recommended yet it requires the above
+		// mentioned pre-requisite.
+		secure: false,
+		// Only set the maxAge to null if the cookie shouldn't be expired
+		// at all. The cookie will expunge when the browser is closed.
+		maxAge: null,
+		// To set the cookie in a specific domain uncomment the following
+		// setting:
+		// domain: 'tellform.com'
+	},
+ 
+	/*
+	 * Upload Configuration
+	 */
+	//Global upload path 
+	uploadPath : 'uploads/',
+	//PDF storage path
+	pdfUploadPath: 'uploads/pdfs/',
+	//Temp files storage path
+	tmpUploadPath: 'uploads/tmp/',
+ 
+	// The session cookie name
+	sessionName: 'connect.sid',
+	log: {
+		// Can specify one of 'combined', 'common', 'dev', 'short', 'tiny'
+		format: 'combined',
+		// Stream defaults to process.stdout
+		// Uncomment to enable logging to a log on the file system
+		options: {
+			stream: 'access.log'
+		}
+	},
+	assets: {
+		css: [
+			'public/modules/**/css/*.css'
+		],
+		js: [
+			'public/config.js',
+			'public/application.js',
+			'public/populate_template_cache.js',
+			'public/modules/*/*.js',
+			'public/modules/*/*[!tests]*/*.js'
+		],
+		views: [
+			'public/modules/*/views/*.html',
+			'public/modules/*/views/*/*.html',
+			'public/modules/*/views/*/*/*.html',
+		],
+		unit_tests: [
+			'public/lib/angular-mocks/angular-mocks.js',
+			'public/modules/*/tests/unit/*.js',
+			'public/modules/*/tests/unit/**/*.js',
+		],
+		e2e_tests: [
+			'public/modules/*/tests/e2e/**.js',
+		]
+	}
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/config/env/api_keys.js.html b/coverageServer/lcov-report/kiosk_form/config/env/api_keys.js.html new file mode 100644 index 00000000..055046b7 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/config/env/api_keys.js.html @@ -0,0 +1,143 @@ + + + + Code coverage report for kiosk_form/config/env/api_keys.js + + + + + + + +
+
+

+ all files / kiosk_form/config/env/ api_keys.js +

+
+
+ 100% + Statements + 1/1 +
+
+ 100% + Branches + 2/2 +
+
+ 100% + Functions + 0/0 +
+
+ 100% + Lines + 1/1 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + 
module.exports = {
+	mailer: {
+		from: 'no-reply@tellform.com',
+		options: {
+			service: 'Mandrill',
+			auth: {
+				user: 'hackouver@gmail.com',
+				pass: 'AVCCf1C2dFlrNhx9Iyi_yQ'
+			}
+		}
+	},
+	sessionSecret: process.env.SESSION_SECRET || 'somethingheresecret',
+	mailosaur: {
+		key: '6a8e7a9880b9098',
+		mailbox_id: 'be1e58fb',
+	},
+	oscarhost: {
+		baseUrl: 'https://secure2.oscarhost.ca/kensington/ws/',
+		settings: {
+			updateType: 'force_add',
+		},
+		auth:{
+			user: 'davieb',
+			pass: 'Temppass1'
+		}
+	}
+};
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/config/env/index.html b/coverageServer/lcov-report/kiosk_form/config/env/index.html new file mode 100644 index 00000000..27471ce1 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/config/env/index.html @@ -0,0 +1,119 @@ + + + + Code coverage report for kiosk_form/config/env/ + + + + + + + +
+
+

+ all files kiosk_form/config/env/ +

+
+
+ 100% + Statements + 3/3 +
+
+ 100% + Branches + 44/44 +
+
+ 100% + Functions + 0/0 +
+
+ 100% + Lines + 3/3 +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
all.js
100%1/1100%6/6100%0/0100%1/1
api_keys.js
100%1/1100%2/2100%0/0100%1/1
test.js
100%1/1100%36/36100%0/0100%1/1
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/config/env/test.js.html b/coverageServer/lcov-report/kiosk_form/config/env/test.js.html new file mode 100644 index 00000000..71eeef6c --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/config/env/test.js.html @@ -0,0 +1,275 @@ + + + + Code coverage report for kiosk_form/config/env/test.js + + + + + + + +
+
+

+ all files / kiosk_form/config/env/ test.js +

+
+
+ 100% + Statements + 1/1 +
+
+ 100% + Branches + 36/36 +
+
+ 100% + Functions + 0/0 +
+
+ 100% + Lines + 1/1 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + 
'use strict';
+ 
+module.exports = {
+	baseUrl: 'http://localhost:3000',
+	db: {
+		uri: 'mongodb://localhost/mean-test',
+		options: {
+			user: '',
+			pass: ''
+		}
+	},
+	port: 3001,
+	log: {
+		// Can specify one of 'combined', 'common', 'dev', 'short', 'tiny'
+		format: 'dev',
+		// Stream defaults to process.stdout
+		// Uncomment to enable logging to a log on the file system
+		options: {
+			//stream: 'access.log'
+		}
+	},
+	app: {
+		title: 'TellForm Test'
+	},
+	facebook: {
+		clientID: process.env.FACEBOOK_ID || 'APP_ID',
+		clientSecret: process.env.FACEBOOK_SECRET || 'APP_SECRET',
+		callbackURL: '/auth/facebook/callback'
+	},
+	twitter: {
+		clientID: process.env.TWITTER_KEY || 'CONSUMER_KEY',
+		clientSecret: process.env.TWITTER_SECRET || 'CONSUMER_SECRET',
+		callbackURL: '/auth/twitter/callback'
+	},
+	google: {
+		clientID: process.env.GOOGLE_ID || 'APP_ID',
+		clientSecret: process.env.GOOGLE_SECRET || 'APP_SECRET',
+		callbackURL: '/auth/google/callback'
+	},
+	linkedin: {
+		clientID: process.env.LINKEDIN_ID || 'APP_ID',
+		clientSecret: process.env.LINKEDIN_SECRET || 'APP_SECRET',
+		callbackURL: '/auth/linkedin/callback'
+	},
+	github: {
+		clientID: process.env.GITHUB_ID || 'APP_ID',
+		clientSecret: process.env.GITHUB_SECRET || 'APP_SECRET',
+		callbackURL: '/auth/github/callback'
+	},
+	mailer: {
+		from: process.env.MAILER_FROM || 'MAILER_FROM',
+		options: {
+			service: process.env.MAILER_SERVICE_PROVIDER || '',
+			auth: {
+				user: process.env.MAILER_EMAIL_ID || '',
+				pass: process.env.MAILER_PASSWORD || ''
+			}
+		}
+	},
+	oscarhost: {
+		baseUrl: process.env.OSCARHOST_BASEURL || 'OSCARHOST_BASEURL',
+		settings: {
+			updateType: process.env.OSCARHOST_UPDATETYPE || 'OSCARHOST_UPDATETYPE',
+		},
+		auth:{
+			user: process.env.OSCARHOST_USER || 'process.env.OSCARHOST_USER',
+			pass: process.env.OSCARHOST_PASS || 'process.env.OSCARHOST_PASS',
+		}
+	}
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/config/express.js.html b/coverageServer/lcov-report/kiosk_form/config/express.js.html new file mode 100644 index 00000000..c34f8109 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/config/express.js.html @@ -0,0 +1,695 @@ + + + + Code coverage report for kiosk_form/config/express.js + + + + + + + +
+
+

+ all files / kiosk_form/config/ express.js +

+
+
+ 73.24% + Statements + 52/71 +
+
+ 40% + Branches + 4/10 +
+
+ 62.5% + Functions + 5/8 +
+
+ 74.29% + Lines + 52/70 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  + +  +  + + +  +  +  + + + + +  + + + +  + + +  +  + + +  +  + + +  +  +  + +  +  + +  +  +  +  +  +  + +  +  +  + +  +  + + +  +  + +  +  + +  +  + +  +  +  +  + +  +  + + +  +  + + + + + +  +  + + +  +  + +  +  + +  +  +  +  +  +  +  +  +  +  +  +  + + +  +  + +  +  + +  +  + + +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  + +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var fs = require('fs-extra'),
+	http = require('http'),
+	https = require('https'),
+	express = require('express'),
+	morgan = require('morgan'),
+	logger = require('./logger'),
+	bodyParser = require('body-parser'),
+	session = require('express-session'),
+	compression = require('compression'),
+	methodOverride = require('method-override'),
+	cookieParser = require('cookie-parser'),
+	helmet = require('helmet'),
+	multer = require('multer'),
+	passport = require('passport'),
+	raven = require('raven'),
+	MongoStore = require('connect-mongo')(session),
+	flash = require('connect-flash'),
+	config = require('./config'),
+	consolidate = require('consolidate'),
+	path = require('path'),
+	device = require('express-device'),
+	client = new raven.Client(config.DSN);
+ 
+ 
+ 
+module.exports = function(db) {
+	// Initialize express app
+	var app = express();
+ 
+	// Globbing model files
+	config.getGlobbedFiles('./app/models/**/*.js').forEach(function(modelPath) {
+		require(path.resolve(modelPath));
+	});
+ 
+	// Setting application local variables
+	app.locals.title = config.app.title;
+	app.locals.description = config.app.description;
+	app.locals.keywords = config.app.keywords;
+	app.locals.facebookAppId = config.facebook.clientID;
+ 
+	app.locals.bowerJSFiles = config.getBowerJSAssets();
+	app.locals.bowerCssFiles = config.getBowerCSSAssets();
+	app.locals.bowerOtherFiles = config.getBowerOtherAssets();
+ 
+	app.locals.jsFiles = config.getJavaScriptAssets();
+	app.locals.cssFiles = config.getCSSAssets();
+ 
+	// Passing the request url to environment locals
+	app.use(function(req, res, next) {
+		Iif(config.baseUrl === ''){
+			config.baseUrl = req.protocol + '://' + req.headers.host;
+		}
+	    res.locals.url = req.protocol + '://' + req.headers.host + req.url;
+		next();
+	});
+ 
+	// Should be placed before express.static
+	app.use(compression({
+		// only compress files for the following content types
+		filter: function(req, res) {
+			return (/json|text|javascript|css/).test(res.getHeader('Content-Type'));
+		},
+		// zlib option for compression level
+		level: 3
+	}));
+ 
+	// Showing stack errors
+	app.set('showStackError', true);
+ 
+ 
+	// Set swig as the template engine
+	app.engine('server.view.html', consolidate[config.templateEngine]);
+ 
+	// Set views path and view engine
+	app.set('view engine', 'server.view.html');
+	app.set('views', './app/views');
+ 
+	// Enable logger (morgan)
+	app.use(morgan(logger.getLogFormat(), logger.getLogOptions()));
+ 
+	// Environment dependent middleware
+	Iif (process.env.NODE_ENV === 'development') {
+		// Disable views cache
+		app.set('view cache', false);
+	} else Iif (process.env.NODE_ENV === 'production') {
+		app.locals.cache = 'memory';
+	}
+ 
+	// Request body parsing middleware should be above methodOverride
+	app.use(bodyParser.urlencoded({
+		extended: true
+	}));
+	app.use(bodyParser.json());
+	app.use(methodOverride());
+ 
+	// Use helmet to secure Express headers
+	app.use(helmet.xframe());
+	app.use(helmet.xssFilter());
+	app.use(helmet.nosniff());
+	app.use(helmet.ienoopen());
+	app.disable('x-powered-by');
+ 
+	// Setting the app router and static folder
+	app.use('/', express.static(path.resolve('./public')));
+	app.use('/uploads', express.static(path.resolve('./uploads')));
+ 
+	// CookieParser should be above session
+	app.use(cookieParser());
+ 
+	// Express MongoDB session storage
+	app.use(session({
+		saveUninitialized: true,
+		resave: true,
+		secret: config.sessionSecret,
+		store: new MongoStore({
+	      mongooseConnection: db.connection,
+	      collection: config.sessionCollection
+	    }),
+		cookie: config.sessionCookie,
+		name: config.sessionName
+	}));
+ 
+	// use passport session
+	app.use(passport.initialize());
+	app.use(passport.session());
+ 
+	// setup express-device
+	app.use(device.capture({ parseUserAgent: true }));
+ 
+	// connect flash for flash messages
+	app.use(flash());
+ 
+	// Globbing routing files
+	config.getGlobbedFiles('./app/routes/**/*.js').forEach(function(routePath) {
+		require(path.resolve(routePath))(app);
+	});
+ 
+	// Add headers for Sentry
+	app.use(function (req, res, next) {
+ 
+	    // Website you wish to allow to connect
+	    res.setHeader('Access-Control-Allow-Origin', 'http://sentry.polydaic.com');
+ 
+	    // Request methods you wish to allow
+	    res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
+ 
+	    // Request headers you wish to allow
+	    res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
+ 
+	    // Set to true if you need the website to include cookies in the requests sent
+	    // to the API (e.g. in case you use sessions)
+	    res.setHeader('Access-Control-Allow-Credentials', true);
+ 
+	    // Pass to next layer of middleware
+	    next();
+	});
+ 
+	// Sentry (Raven) middleware
+	app.use(raven.middleware.express.requestHandler(config.DSN));
+ 
+	// Should come before any other error middleware
+	app.use(raven.middleware.express.errorHandler(config.DSN));
+ 
+	// Assume 'not found' in the error msgs is a 404. this is somewhat silly, but valid, you can do whatever you like, set properties, use instanceof etc.
+	app.use(function(err, req, res, next) {
+		// If the error object doesn't exists
+		if (!err) return next();
+ 
+		// Log it
+		console.error(err.stack);
+		client.captureError(err);
+ 
+		// Error page
+		res.status(500).render('500', {
+			error: err.stack
+		});
+	});
+ 
+	// Assume 404 since no middleware responded
+	app.use(function(req, res) {
+		client.captureError(new Error('Page Not Found'));
+		res.status(404).render('404', {
+			url: req.originalUrl,
+			error: 'Not Found'
+		});
+	});
+ 
+	Iif (process.env.NODE_ENV === 'secure') {
+		// Load SSL key and certificate
+		var privateKey = fs.readFileSync('./config/sslcerts/key.pem', 'utf8');
+		var certificate = fs.readFileSync('./config/sslcerts/cert.pem', 'utf8');
+ 
+		// Create HTTPS Server
+		var httpsServer = https.createServer({
+			key: privateKey,
+			cert: certificate
+		}, app);
+ 
+		// Return HTTPS server instance
+		return httpsServer;
+	}
+ 
+	// Return Express server instance
+	return app;
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/config/index.html b/coverageServer/lcov-report/kiosk_form/config/index.html new file mode 100644 index 00000000..8bb1c706 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/config/index.html @@ -0,0 +1,145 @@ + + + + Code coverage report for kiosk_form/config/ + + + + + + + +
+
+

+ all files kiosk_form/config/ +

+
+
+ 77.37% + Statements + 106/137 +
+
+ 50% + Branches + 15/30 +
+
+ 76.92% + Functions + 20/26 +
+
+ 77.94% + Lines + 106/136 +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
config.js
92.11%35/3864.29%9/14100%10/1092.11%35/38
express.js
73.24%52/7140%4/1062.5%5/874.29%52/70
init.js
50%4/825%1/4100%1/150%4/8
logger.js
81.82%9/1150%1/2100%2/281.82%9/11
passport.js
66.67%6/9100%0/040%2/566.67%6/9
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/config/init.js.html b/coverageServer/lcov-report/kiosk_form/config/init.js.html new file mode 100644 index 00000000..94ba567c --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/config/init.js.html @@ -0,0 +1,152 @@ + + + + Code coverage report for kiosk_form/config/init.js + + + + + + + +
+
+

+ all files / kiosk_form/config/ init.js +

+
+
+ 50% + Statements + 4/8 +
+
+ 25% + Branches + 1/4 +
+
+ 100% + Functions + 1/1 +
+
+ 50% + Lines + 4/8 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30  +  +  +  +  + +  +  +  +  +  + +  +  +  +  + + +  +  +  +  +  +  +  +  +  +  +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var glob = require('glob'),
+	chalk = require('chalk');
+ 
+/**
+ * Module init function.
+ */
+module.exports = function() {
+	/**
+	 * Before we begin, lets set the environment variable
+	 * We'll Look for a valid NODE_ENV variable and if one cannot be found load the development NODE_ENV
+	 */
+	var environmentFiles = glob.sync('./config/env/' + process.env.NODE_ENV + '.js');
+	Iif (!environmentFiles.length) {
+		if (process.env.NODE_ENV) {
+			console.error(chalk.red('No configuration file found for "' + process.env.NODE_ENV + '" environment using development instead'));
+		} else {
+			console.error(chalk.red('NODE_ENV is not defined! Using default development environment'));
+		}
+ 
+		process.env.NODE_ENV = 'development';
+	}
+ 
+ 
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/config/logger.js.html b/coverageServer/lcov-report/kiosk_form/config/logger.js.html new file mode 100644 index 00000000..717065d5 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/config/logger.js.html @@ -0,0 +1,173 @@ + + + + Code coverage report for kiosk_form/config/logger.js + + + + + + + +
+
+

+ all files / kiosk_form/config/ logger.js +

+
+
+ 81.82% + Statements + 9/11 +
+
+ 50% + Branches + 1/2 +
+
+ 100% + Functions + 2/2 +
+
+ 81.82% + Lines + 9/11 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37  +  +  +  +  +  + + + +  +  +  +  + +  +  + +  +  +  + +  + + +  +  +  +  +  +  +  +  + +  +  +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+ 
+var morgan = require('morgan');
+var config = require('./config');
+var fs = require('fs-extra');
+ 
+/**
+ * Module init function.
+ */
+module.exports = {
+ 
+	getLogFormat: function() {
+		return config.log.format;
+	},
+ 
+	getLogOptions: function() {
+		var options = {};
+ 
+		try {
+			Iif ('stream' in config.log.options) {
+				options = {
+					stream: fs.createWriteStream(process.cwd() + '/' + config.log.options.stream, {flags: 'a'})
+				};
+			}
+		} catch (e) {
+			options = {};
+		}
+ 
+		return options;
+	}
+ 
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/config/passport.js.html b/coverageServer/lcov-report/kiosk_form/config/passport.js.html new file mode 100644 index 00000000..6b9fffa1 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/config/passport.js.html @@ -0,0 +1,164 @@ + + + + Code coverage report for kiosk_form/config/passport.js + + + + + + + +
+
+

+ all files / kiosk_form/config/ passport.js +

+
+
+ 66.67% + Statements + 6/9 +
+
+ 100% + Branches + 0/0 +
+
+ 40% + Functions + 2/5 +
+
+ 66.67% + Lines + 6/9 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34  +  +  +  +  + +  +  +  +  +  +  +  + +  + +  +  +  +  + +  +  +  +  +  +  +  +  + + +  +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var passport = require('passport'),
+	User = require('mongoose').model('User'),
+	path = require('path'),
+	config = require('./config');
+ 
+/**
+ * Module init function.
+ */
+module.exports = function() {
+	// Serialize sessions
+	passport.serializeUser(function(user, done) {
+		done(null, user.id);
+	});
+ 
+	// Deserialize sessions
+	passport.deserializeUser(function(id, done) {
+		User.findOne({
+			_id: id
+		}, '-salt -password', function(err, user) {
+			done(err, user);
+		});
+	});
+ 
+	// Initialize strategies
+	config.getGlobbedFiles('./config/strategies/**/*.js').forEach(function(strategy) {
+		require(path.resolve(strategy))();
+	});
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/config/strategies/facebook.js.html b/coverageServer/lcov-report/kiosk_form/config/strategies/facebook.js.html new file mode 100644 index 00000000..e8892926 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/config/strategies/facebook.js.html @@ -0,0 +1,188 @@ + + + + Code coverage report for kiosk_form/config/strategies/facebook.js + + + + + + + +
+
+

+ all files / kiosk_form/config/strategies/ facebook.js +

+
+
+ 37.5% + Statements + 3/8 +
+
+ 100% + Branches + 0/0 +
+
+ 50% + Functions + 1/2 +
+
+ 37.5% + Lines + 3/8 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42  +  +  +  +  + +  +  +  +  + +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var passport = require('passport'),
+	FacebookStrategy = require('passport-facebook').Strategy,
+	config = require('../config'),
+	users = require('../../app/controllers/users.server.controller');
+ 
+module.exports = function() {
+	// Use facebook strategy
+	passport.use(new FacebookStrategy({
+			clientID: config.facebook.clientID,
+			clientSecret: config.facebook.clientSecret,
+			callbackURL: config.facebook.callbackURL,
+			passReqToCallback: true
+		},
+		function(req, accessToken, refreshToken, profile, done) {
+			// Set the provider data and include tokens
+			var providerData = profile._json;
+			providerData.accessToken = accessToken;
+			providerData.refreshToken = refreshToken;
+ 
+			// Create the user OAuth profile
+			var providerUserProfile = {
+				firstName: profile.name.givenName,
+				lastName: profile.name.familyName,
+				displayName: profile.displayName,
+				email: profile.emails[0].value,
+				username: profile.username,
+				provider: 'facebook',
+				providerIdentifierField: 'id',
+				providerData: providerData
+			};
+ 
+			// Save the user OAuth profile
+			users.saveOAuthUserProfile(req, providerUserProfile, done);
+		}
+	));
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/config/strategies/github.js.html b/coverageServer/lcov-report/kiosk_form/config/strategies/github.js.html new file mode 100644 index 00000000..ee1e30bb --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/config/strategies/github.js.html @@ -0,0 +1,203 @@ + + + + Code coverage report for kiosk_form/config/strategies/github.js + + + + + + + +
+
+

+ all files / kiosk_form/config/strategies/ github.js +

+
+
+ 25% + Statements + 3/12 +
+
+ 0% + Branches + 0/4 +
+
+ 50% + Functions + 1/2 +
+
+ 25% + Lines + 3/12 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47  +  +  +  +  + +  +  +  +  + +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var passport = require('passport'),
+	GithubStrategy = require('passport-github').Strategy,
+	config = require('../config'),
+	users = require('../../app/controllers/users.server.controller');
+ 
+module.exports = function() {
+	// Use github strategy
+	passport.use(new GithubStrategy({
+			clientID: config.github.clientID,
+			clientSecret: config.github.clientSecret,
+			callbackURL: config.github.callbackURL,
+			passReqToCallback: true
+		},
+		function(req, accessToken, refreshToken, profile, done) {
+			// Set the provider data and include tokens
+			var providerData = profile._json;
+			providerData.accessToken = accessToken;
+			providerData.refreshToken = refreshToken;
+ 
+			// Create the user OAuth profile
+			var displayName = profile.displayName.trim();
+			var iSpace = displayName.indexOf(' '); // index of the whitespace following the firstName
+			var firstName =  iSpace !== -1 ? displayName.substring(0, iSpace) : displayName;
+			var lastName = iSpace !== -1 ? displayName.substring(iSpace + 1) : '';
+ 
+			var providerUserProfile = {
+				firstName: firstName,
+				lastName: lastName,
+				displayName: displayName,
+				email: profile.emails[0].value,
+				username: profile.username,
+				provider: 'github',
+				providerIdentifierField: 'id',
+				providerData: providerData
+			};
+ 
+			// Save the user OAuth profile
+			users.saveOAuthUserProfile(req, providerUserProfile, done);
+		}
+	));
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/config/strategies/google.js.html b/coverageServer/lcov-report/kiosk_form/config/strategies/google.js.html new file mode 100644 index 00000000..2927fe6a --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/config/strategies/google.js.html @@ -0,0 +1,188 @@ + + + + Code coverage report for kiosk_form/config/strategies/google.js + + + + + + + +
+
+

+ all files / kiosk_form/config/strategies/ google.js +

+
+
+ 37.5% + Statements + 3/8 +
+
+ 100% + Branches + 0/0 +
+
+ 50% + Functions + 1/2 +
+
+ 37.5% + Lines + 3/8 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42  +  +  +  +  + +  +  +  +  + +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var passport = require('passport'),
+	GoogleStrategy = require('passport-google-oauth').OAuth2Strategy,
+	config = require('../config'),
+	users = require('../../app/controllers/users.server.controller');
+ 
+module.exports = function() {
+	// Use google strategy
+	passport.use(new GoogleStrategy({
+			clientID: config.google.clientID,
+			clientSecret: config.google.clientSecret,
+			callbackURL: config.google.callbackURL,
+			passReqToCallback: true
+		},
+		function(req, accessToken, refreshToken, profile, done) {
+			// Set the provider data and include tokens
+			var providerData = profile._json;
+			providerData.accessToken = accessToken;
+			providerData.refreshToken = refreshToken;
+ 
+			// Create the user OAuth profile
+			var providerUserProfile = {
+				firstName: profile.name.givenName,
+				lastName: profile.name.familyName,
+				displayName: profile.displayName,
+				email: profile.emails[0].value,
+				username: profile.username,
+				provider: 'google',
+				providerIdentifierField: 'id',
+				providerData: providerData
+			};
+ 
+			// Save the user OAuth profile
+			users.saveOAuthUserProfile(req, providerUserProfile, done);
+		}
+	));
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/config/strategies/index.html b/coverageServer/lcov-report/kiosk_form/config/strategies/index.html new file mode 100644 index 00000000..c2a28bd9 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/config/strategies/index.html @@ -0,0 +1,158 @@ + + + + Code coverage report for kiosk_form/config/strategies/ + + + + + + + +
+
+

+ all files kiosk_form/config/strategies/ +

+
+
+ 37.29% + Statements + 22/59 +
+
+ 14.29% + Branches + 2/14 +
+
+ 61.54% + Functions + 8/13 +
+
+ 37.29% + Lines + 22/59 +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
facebook.js
37.5%3/8100%0/050%1/237.5%3/8
github.js
25%3/120%0/450%1/225%3/12
google.js
37.5%3/8100%0/050%1/237.5%3/8
linkedin.js
37.5%3/8100%0/050%1/237.5%3/8
local.js
63.64%7/1133.33%2/6100%3/363.64%7/11
twitter.js
25%3/120%0/450%1/225%3/12
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/config/strategies/linkedin.js.html b/coverageServer/lcov-report/kiosk_form/config/strategies/linkedin.js.html new file mode 100644 index 00000000..e3a9b56b --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/config/strategies/linkedin.js.html @@ -0,0 +1,191 @@ + + + + Code coverage report for kiosk_form/config/strategies/linkedin.js + + + + + + + +
+
+

+ all files / kiosk_form/config/strategies/ linkedin.js +

+
+
+ 37.5% + Statements + 3/8 +
+
+ 100% + Branches + 0/0 +
+
+ 50% + Functions + 1/2 +
+
+ 37.5% + Lines + 3/8 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43  +  +  +  +  + +  +  +  +  + +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var passport = require('passport'),
+	LinkedInStrategy = require('passport-linkedin').Strategy,
+	config = require('../config'),
+	users = require('../../app/controllers/users.server.controller');
+ 
+module.exports = function() {
+	// Use linkedin strategy
+	passport.use(new LinkedInStrategy({
+			consumerKey: config.linkedin.clientID,
+			consumerSecret: config.linkedin.clientSecret,
+			callbackURL: config.linkedin.callbackURL,
+			passReqToCallback: true,
+			profileFields: ['id', 'first-name', 'last-name', 'email-address']
+		},
+		function(req, accessToken, refreshToken, profile, done) {
+			// Set the provider data and include tokens
+			var providerData = profile._json;
+			providerData.accessToken = accessToken;
+			providerData.refreshToken = refreshToken;
+ 
+			// Create the user OAuth profile
+			var providerUserProfile = {
+				firstName: profile.name.givenName,
+				lastName: profile.name.familyName,
+				displayName: profile.displayName,
+				email: profile.emails[0].value,
+				username: profile.username,
+				provider: 'linkedin',
+				providerIdentifierField: 'id',
+				providerData: providerData
+			};
+ 
+			// Save the user OAuth profile
+			users.saveOAuthUserProfile(req, providerUserProfile, done);
+		}
+	));
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/config/strategies/local.js.html b/coverageServer/lcov-report/kiosk_form/config/strategies/local.js.html new file mode 100644 index 00000000..a13d253d --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/config/strategies/local.js.html @@ -0,0 +1,179 @@ + + + + Code coverage report for kiosk_form/config/strategies/local.js + + + + + + + +
+
+

+ all files / kiosk_form/config/strategies/ local.js +

+
+
+ 63.64% + Statements + 7/11 +
+
+ 33.33% + Branches + 2/6 +
+
+ 100% + Functions + 3/3 +
+
+ 63.64% + Lines + 7/11 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39  +  +  +  +  + +  +  +  + +  + +  +  +  +  + +  +  + +  +  + + +  +  +  +  +  +  +  +  +  +  +  +  +  +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var passport = require('passport'),
+	LocalStrategy = require('passport-local').Strategy,
+	User = require('mongoose').model('User');
+ 
+module.exports = function() {
+	// Use local strategy
+	passport.use(new LocalStrategy({
+			usernameField: 'username',
+			passwordField: 'password'
+		},
+		function(username, password, done) {
+			User.findOne({
+				username: username
+			}, function(err, user) {
+				Iif (err) {
+					return done(err);
+				}
+				Eif (!user) {
+					return done(null, false, {
+						message: 'Unknown user or invalid password'
+					});
+				}
+				if (!user.authenticate(password)) {
+					return done(null, false, {
+						message: 'Unknown user or invalid password'
+					});
+				}
+ 
+				return done(null, user);
+			});
+		}
+	));
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/config/strategies/twitter.js.html b/coverageServer/lcov-report/kiosk_form/config/strategies/twitter.js.html new file mode 100644 index 00000000..d7ba9983 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/config/strategies/twitter.js.html @@ -0,0 +1,200 @@ + + + + Code coverage report for kiosk_form/config/strategies/twitter.js + + + + + + + +
+
+

+ all files / kiosk_form/config/strategies/ twitter.js +

+
+
+ 25% + Statements + 3/12 +
+
+ 0% + Branches + 0/4 +
+
+ 50% + Functions + 1/2 +
+
+ 25% + Lines + 3/12 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46  +  +  +  +  + +  +  +  +  + +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + 
'use strict';
+ 
+/**
+ * Module dependencies.
+ */
+var passport = require('passport'),
+	TwitterStrategy = require('passport-twitter').Strategy,
+	config = require('../config'),
+	users = require('../../app/controllers/users.server.controller');
+ 
+module.exports = function() {
+	// Use twitter strategy
+	passport.use(new TwitterStrategy({
+			consumerKey: config.twitter.clientID,
+			consumerSecret: config.twitter.clientSecret,
+			callbackURL: config.twitter.callbackURL,
+			passReqToCallback: true
+		},
+		function(req, token, tokenSecret, profile, done) {
+			// Set the provider data and include tokens
+			var providerData = profile._json;
+			providerData.token = token;
+			providerData.tokenSecret = tokenSecret;
+ 
+			// Create the user OAuth profile
+			var displayName = profile.displayName.trim();
+			var iSpace = displayName.indexOf(' '); // index of the whitespace following the firstName
+			var firstName =  iSpace !== -1 ? displayName.substring(0, iSpace) : displayName;
+			var lastName = iSpace !== -1 ? displayName.substring(iSpace + 1) : '';
+ 
+			var providerUserProfile = {
+				firstName: firstName,
+				lastName: lastName,
+				displayName: displayName,
+				username: profile.username,
+				provider: 'twitter',
+				providerIdentifierField: 'id_str',
+				providerData: providerData
+			};
+ 
+			// Save the user OAuth profile
+			users.saveOAuthUserProfile(req, providerUserProfile, done);
+		}
+	));
+};
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/index.html b/coverageServer/lcov-report/kiosk_form/index.html new file mode 100644 index 00000000..e04f484f --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/index.html @@ -0,0 +1,93 @@ + + + + Code coverage report for kiosk_form/ + + + + + + + +
+
+

+ all files kiosk_form/ +

+
+
+ 76.19% + Statements + 16/21 +
+
+ 50% + Branches + 2/4 +
+
+ 50% + Functions + 1/2 +
+
+ 76.19% + Lines + 16/21 +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
server.js
76.19%16/2150%2/450%1/276.19%16/21
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/scripts/oscarhost/OscarSecurity.js.html b/coverageServer/lcov-report/kiosk_form/scripts/oscarhost/OscarSecurity.js.html new file mode 100644 index 00000000..c535c698 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/scripts/oscarhost/OscarSecurity.js.html @@ -0,0 +1,134 @@ + + + + Code coverage report for kiosk_form/scripts/oscarhost/OscarSecurity.js + + + + + + + +
+
+

+ all files / kiosk_form/scripts/oscarhost/ OscarSecurity.js +

+
+
+ 50% + Statements + 4/8 +
+
+ 100% + Branches + 0/0 +
+
+ 0% + Functions + 0/2 +
+
+ 50% + Lines + 4/8 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24  +  + +  +  + +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  + + 
"use strict";
+ 
+var crypto = require('crypto'), 
+    passwordDigest = require('soap/lib/utils').passwordDigest;
+ 
+function WSSecurity(username, password) {
+  this._username = username;
+  this._password = password;
+}
+ 
+WSSecurity.prototype.toXML = function() {
+  var password = "<wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\">" + this._password + "</wsse:Password>";
+ 
+  return  "<wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" soap:mustUnderstand=\"1\">" +
+            "<wsse:UsernameToken xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" wsu:Id=\"UsernameToken-1\">" +
+              "<wsse:Username>" + this._username + "</wsse:Username>" +
+              password +
+            "</wsse:UsernameToken>" +
+          "</wsse:Security>";
+ 
+};
+ 
+module.exports = WSSecurity;
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/scripts/oscarhost/index.html b/coverageServer/lcov-report/kiosk_form/scripts/oscarhost/index.html new file mode 100644 index 00000000..d82d1de5 --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/scripts/oscarhost/index.html @@ -0,0 +1,93 @@ + + + + Code coverage report for kiosk_form/scripts/oscarhost/ + + + + + + + +
+
+

+ all files kiosk_form/scripts/oscarhost/ +

+
+
+ 50% + Statements + 4/8 +
+
+ 100% + Branches + 0/0 +
+
+ 0% + Functions + 0/2 +
+
+ 50% + Lines + 4/8 +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
OscarSecurity.js
50%4/8100%0/00%0/250%4/8
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/kiosk_form/server.js.html b/coverageServer/lcov-report/kiosk_form/server.js.html new file mode 100644 index 00000000..03352adf --- /dev/null +++ b/coverageServer/lcov-report/kiosk_form/server.js.html @@ -0,0 +1,218 @@ + + + + Code coverage report for kiosk_form/server.js + + + + + + + +
+
+

+ all files / kiosk_form/ server.js +

+
+
+ 76.19% + Statements + 16/21 +
+
+ 50% + Branches + 2/4 +
+
+ 50% + Functions + 1/2 +
+
+ 76.19% + Lines + 16/21 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52  +  +  +  + +  +  +  +  + +  +  +  +  +  +  +  +  + + +  +  +  +  + +  +  +  +  +  + +  +  + +  +  + +  +  + +  +  + + + + + + +  +  + + 
'use strict';
+/**
+ * Module dependencies.
+ */
+var init = require('./config/init')(),
+	config = require('./config/config'),
+	mongoose = require('mongoose'),
+	chalk = require('chalk');
+ 
+require('events').EventEmitter.prototype._maxListeners = 100;
+ 
+ 
+/**
+ * Main application entry file.
+ * Please note that the order of loading is important.
+ */
+ 
+// Bootstrap db connection
+var db = mongoose.connect(config.db.uri, config.db.options, function(err) {
+	Iif (err) {
+		console.error(chalk.red('Could not connect to MongoDB!'));
+		console.log(chalk.red(err));
+	}
+});
+mongoose.connection.on('error', function(err) {
+	console.error(chalk.red('MongoDB connection error: ' + err));
+	process.exit(-1);
+});
+ 
+// Init the express application
+var app = require('./config/express')(db);
+ 
+// Bootstrap passport config
+require('./config/passport')();
+ 
+// Start the app by listening on <port>
+app.listen(config.port);
+ 
+// Expose app
+exports = module.exports = app;
+ 
+// Logging initialization
+console.log('--');
+console.log(chalk.green(config.app.title + ' application started'));
+console.log(chalk.green('Environment:\t\t\t' + process.env.NODE_ENV));
+console.log(chalk.green('Port:\t\t\t\t' + config.port));
+console.log(chalk.green('Database:\t\t\t' + config.db.uri));
+Iif (process.env.NODE_ENV === 'secure') {
+	console.log(chalk.green('HTTPs:\t\t\t\ton'));
+}
+console.log('--');
+ 
+
+
+ + + + + + + diff --git a/coverageServer/lcov-report/prettify.css b/coverageServer/lcov-report/prettify.css new file mode 100644 index 00000000..b317a7cd --- /dev/null +++ b/coverageServer/lcov-report/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/coverageServer/lcov-report/prettify.js b/coverageServer/lcov-report/prettify.js new file mode 100644 index 00000000..ef51e038 --- /dev/null +++ b/coverageServer/lcov-report/prettify.js @@ -0,0 +1 @@ +window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/coverageServer/lcov-report/sort-arrow-sprite.png b/coverageServer/lcov-report/sort-arrow-sprite.png new file mode 100644 index 00000000..03f704a6 Binary files /dev/null and b/coverageServer/lcov-report/sort-arrow-sprite.png differ diff --git a/coverageServer/lcov-report/sorter.js b/coverageServer/lcov-report/sorter.js new file mode 100644 index 00000000..97d25508 --- /dev/null +++ b/coverageServer/lcov-report/sorter.js @@ -0,0 +1,156 @@ +var addSorting = (function () { + "use strict"; + var cols, + currentSort = { + index: 0, + desc: false + }; + + // returns the summary table element + function getTable() { return document.querySelector('.coverage-summary'); } + // returns the thead element of the summary table + function getTableHeader() { return getTable().querySelector('thead tr'); } + // returns the tbody element of the summary table + function getTableBody() { return getTable().querySelector('tbody'); } + // returns the th element for nth column + function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; } + + // loads all columns + function loadColumns() { + var colNodes = getTableHeader().querySelectorAll('th'), + colNode, + cols = [], + col, + i; + + for (i = 0; i < colNodes.length; i += 1) { + colNode = colNodes[i]; + col = { + key: colNode.getAttribute('data-col'), + sortable: !colNode.getAttribute('data-nosort'), + type: colNode.getAttribute('data-type') || 'string' + }; + cols.push(col); + if (col.sortable) { + col.defaultDescSort = col.type === 'number'; + colNode.innerHTML = colNode.innerHTML + ''; + } + } + return cols; + } + // attaches a data attribute to every tr element with an object + // of data values keyed by column name + function loadRowData(tableRow) { + var tableCols = tableRow.querySelectorAll('td'), + colNode, + col, + data = {}, + i, + val; + for (i = 0; i < tableCols.length; i += 1) { + colNode = tableCols[i]; + col = cols[i]; + val = colNode.getAttribute('data-value'); + if (col.type === 'number') { + val = Number(val); + } + data[col.key] = val; + } + return data; + } + // loads all row data + function loadData() { + var rows = getTableBody().querySelectorAll('tr'), + i; + + for (i = 0; i < rows.length; i += 1) { + rows[i].data = loadRowData(rows[i]); + } + } + // sorts the table using the data for the ith column + function sortByIndex(index, desc) { + var key = cols[index].key, + sorter = function (a, b) { + a = a.data[key]; + b = b.data[key]; + return a < b ? -1 : a > b ? 1 : 0; + }, + finalSorter = sorter, + tableBody = document.querySelector('.coverage-summary tbody'), + rowNodes = tableBody.querySelectorAll('tr'), + rows = [], + i; + + if (desc) { + finalSorter = function (a, b) { + return -1 * sorter(a, b); + }; + } + + for (i = 0; i < rowNodes.length; i += 1) { + rows.push(rowNodes[i]); + tableBody.removeChild(rowNodes[i]); + } + + rows.sort(finalSorter); + + for (i = 0; i < rows.length; i += 1) { + tableBody.appendChild(rows[i]); + } + } + // removes sort indicators for current column being sorted + function removeSortIndicators() { + var col = getNthColumn(currentSort.index), + cls = col.className; + + cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); + col.className = cls; + } + // adds sort indicators for current column being sorted + function addSortIndicators() { + getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted'; + } + // adds event listeners for all sorter widgets + function enableUI() { + var i, + el, + ithSorter = function ithSorter(i) { + var col = cols[i]; + + return function () { + var desc = col.defaultDescSort; + + if (currentSort.index === i) { + desc = !currentSort.desc; + } + sortByIndex(i, desc); + removeSortIndicators(); + currentSort.index = i; + currentSort.desc = desc; + addSortIndicators(); + }; + }; + for (i =0 ; i < cols.length; i += 1) { + if (cols[i].sortable) { + el = getNthColumn(i).querySelector('.sorter'); + if (el.addEventListener) { + el.addEventListener('click', ithSorter(i)); + } else { + el.attachEvent('onclick', ithSorter(i)); + } + } + } + } + // adds sorting functionality to the UI + return function () { + if (!getTable()) { + return; + } + cols = loadColumns(); + loadData(cols); + addSortIndicators(); + enableUI(); + }; +})(); + +window.addEventListener('load', addSorting); diff --git a/coverageServer/lcov.info b/coverageServer/lcov.info new file mode 100644 index 00000000..538b6720 --- /dev/null +++ b/coverageServer/lcov.info @@ -0,0 +1,1997 @@ +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/server.js +FN:19,(anonymous_1) +FN:25,(anonymous_2) +FNF:2 +FNH:1 +FNDA:1,(anonymous_1) +FNDA:0,(anonymous_2) +DA:5,1 +DA:10,1 +DA:19,1 +DA:20,1 +DA:21,0 +DA:22,0 +DA:25,1 +DA:26,0 +DA:27,0 +DA:31,1 +DA:34,1 +DA:37,1 +DA:40,1 +DA:43,1 +DA:44,1 +DA:45,1 +DA:46,1 +DA:47,1 +DA:48,1 +DA:49,0 +DA:51,1 +LF:21 +LH:16 +BRDA:20,1,0,0 +BRDA:20,1,1,1 +BRDA:48,2,0,0 +BRDA:48,2,1,1 +BRF:4 +BRH:2 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/config/init.js +FN:12,(anonymous_1) +FNF:1 +FNH:1 +FNDA:1,(anonymous_1) +DA:6,1 +DA:12,1 +DA:17,1 +DA:18,1 +DA:19,0 +DA:20,0 +DA:22,0 +DA:25,0 +LF:8 +LH:4 +BRDA:18,1,0,0 +BRDA:18,1,1,1 +BRDA:19,2,0,0 +BRDA:19,2,1,0 +BRF:4 +BRH:1 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/config/config.js +FN:34,(anonymous_1) +FN:46,(anonymous_2) +FN:55,(anonymous_3) +FN:67,(anonymous_4) +FN:68,(anonymous_5) +FN:76,(anonymous_6) +FN:79,(anonymous_7) +FN:82,(anonymous_8) +FN:89,(anonymous_9) +FN:103,(anonymous_10) +FNF:10 +FNH:10 +FNDA:11,(anonymous_1) +FNDA:6,(anonymous_2) +FNDA:44,(anonymous_3) +FNDA:3,(anonymous_4) +FNDA:40,(anonymous_5) +FNDA:1,(anonymous_6) +FNDA:1,(anonymous_7) +FNDA:1,(anonymous_8) +FNDA:1,(anonymous_9) +FNDA:1,(anonymous_10) +DA:6,1 +DA:15,1 +DA:21,1 +DA:22,1 +DA:27,0 +DA:34,1 +DA:36,11 +DA:39,11 +DA:42,11 +DA:45,11 +DA:46,2 +DA:47,6 +DA:49,9 +DA:50,9 +DA:51,0 +DA:53,9 +DA:54,9 +DA:55,6 +DA:56,44 +DA:60,9 +DA:64,11 +DA:67,1 +DA:68,3 +DA:69,40 +DA:76,1 +DA:77,1 +DA:79,1 +DA:80,1 +DA:82,1 +DA:83,1 +DA:89,1 +DA:90,1 +DA:93,1 +DA:94,0 +DA:97,1 +DA:103,1 +DA:104,1 +DA:105,1 +LF:38 +LH:35 +BRDA:17,1,0,1 +BRDA:17,1,1,0 +BRDA:21,2,0,1 +BRDA:21,2,1,0 +BRDA:45,3,0,2 +BRDA:45,3,1,9 +BRDA:49,4,0,9 +BRDA:49,4,1,0 +BRDA:50,5,0,0 +BRDA:50,5,1,9 +BRDA:54,6,0,6 +BRDA:54,6,1,3 +BRDA:93,7,0,0 +BRDA:93,7,1,1 +BRF:14 +BRH:9 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/config/env/all.js +FNF:0 +FNH:0 +DA:3,1 +LF:1 +LH:1 +BRDA:9,1,0,1 +BRDA:9,1,1,1 +BRDA:16,2,0,1 +BRDA:16,2,1,1 +BRDA:17,3,0,1 +BRDA:17,3,1,1 +BRF:6 +BRH:6 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/config/env/test.js +FNF:0 +FNH:0 +DA:3,1 +LF:1 +LH:1 +BRDA:26,1,0,1 +BRDA:26,1,1,1 +BRDA:27,2,0,1 +BRDA:27,2,1,1 +BRDA:31,3,0,1 +BRDA:31,3,1,1 +BRDA:32,4,0,1 +BRDA:32,4,1,1 +BRDA:36,5,0,1 +BRDA:36,5,1,1 +BRDA:37,6,0,1 +BRDA:37,6,1,1 +BRDA:41,7,0,1 +BRDA:41,7,1,1 +BRDA:42,8,0,1 +BRDA:42,8,1,1 +BRDA:46,9,0,1 +BRDA:46,9,1,1 +BRDA:47,10,0,1 +BRDA:47,10,1,1 +BRDA:51,11,0,1 +BRDA:51,11,1,1 +BRDA:53,12,0,1 +BRDA:53,12,1,1 +BRDA:55,13,0,1 +BRDA:55,13,1,1 +BRDA:56,14,0,1 +BRDA:56,14,1,1 +BRDA:61,15,0,1 +BRDA:61,15,1,1 +BRDA:63,16,0,1 +BRDA:63,16,1,1 +BRDA:66,17,0,1 +BRDA:66,17,1,1 +BRDA:67,18,0,1 +BRDA:67,18,1,1 +BRF:36 +BRH:36 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/config/env/api_keys.js +FNF:0 +FNH:0 +DA:1,1 +LF:1 +LH:1 +BRDA:12,1,0,1 +BRDA:12,1,1,1 +BRF:2 +BRH:2 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/config/express.js +FN:31,(anonymous_1) +FN:36,(anonymous_2) +FN:54,(anonymous_3) +FN:65,(anonymous_4) +FN:139,(anonymous_5) +FN:144,(anonymous_6) +FN:170,(anonymous_7) +FN:185,(anonymous_8) +FNF:8 +FNH:5 +FNDA:1,(anonymous_1) +FNDA:5,(anonymous_2) +FNDA:4,(anonymous_3) +FNDA:4,(anonymous_4) +FNDA:3,(anonymous_5) +FNDA:0,(anonymous_6) +FNDA:0,(anonymous_7) +FNDA:0,(anonymous_8) +DA:6,1 +DA:31,1 +DA:33,1 +DA:36,1 +DA:37,5 +DA:41,1 +DA:42,1 +DA:43,1 +DA:44,1 +DA:46,1 +DA:47,1 +DA:48,1 +DA:50,1 +DA:51,1 +DA:54,1 +DA:55,4 +DA:56,0 +DA:58,4 +DA:59,4 +DA:63,1 +DA:66,4 +DA:73,1 +DA:77,1 +DA:80,1 +DA:81,1 +DA:84,1 +DA:87,1 +DA:89,0 +DA:90,1 +DA:91,0 +DA:95,1 +DA:98,1 +DA:99,1 +DA:102,1 +DA:103,1 +DA:104,1 +DA:105,1 +DA:106,1 +DA:109,1 +DA:110,1 +DA:113,1 +DA:116,1 +DA:129,1 +DA:130,1 +DA:133,1 +DA:136,1 +DA:139,1 +DA:140,3 +DA:144,1 +DA:147,0 +DA:150,0 +DA:153,0 +DA:157,0 +DA:160,0 +DA:164,1 +DA:167,1 +DA:170,1 +DA:172,0 +DA:175,0 +DA:176,0 +DA:179,0 +DA:185,1 +DA:186,0 +DA:187,0 +DA:193,1 +DA:195,0 +DA:196,0 +DA:199,0 +DA:205,0 +DA:209,1 +LF:70 +LH:52 +BRDA:55,1,0,0 +BRDA:55,1,1,4 +BRDA:87,2,0,0 +BRDA:87,2,1,1 +BRDA:90,3,0,0 +BRDA:90,3,1,1 +BRDA:172,4,0,0 +BRDA:172,4,1,0 +BRDA:193,5,0,0 +BRDA:193,5,1,1 +BRF:10 +BRH:4 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/config/logger.js +FN:16,(anonymous_1) +FN:20,(anonymous_2) +FNF:2 +FNH:2 +FNDA:1,(anonymous_1) +FNDA:1,(anonymous_2) +DA:7,1 +DA:8,1 +DA:9,1 +DA:14,1 +DA:17,1 +DA:21,1 +DA:23,1 +DA:24,1 +DA:25,0 +DA:30,0 +DA:33,1 +LF:11 +LH:9 +BRDA:24,1,0,0 +BRDA:24,1,1,1 +BRF:2 +BRH:1 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/app/models/form_field.server.model.js +FN:98,(anonymous_1) +FNF:1 +FNH:1 +FNDA:5,(anonymous_1) +DA:6,1 +DA:11,1 +DA:30,1 +DA:92,1 +DA:98,1 +DA:99,5 +DA:100,5 +DA:104,1 +DA:106,1 +LF:9 +LH:9 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/app/models/form_submission.server.model.js +FN:129,(anonymous_1) +FN:134,(anonymous_2) +FN:135,(anonymous_3) +FN:163,(anonymous_4) +FN:191,(anonymous_5) +FN:193,(anonymous_6) +FN:194,(anonymous_7) +FN:202,(anonymous_8) +FN:205,(anonymous_9) +FN:208,(anonymous_10) +FN:218,(anonymous_11) +FN:236,(anonymous_12) +FN:240,(anonymous_13) +FN:251,(anonymous_14) +FN:264,(anonymous_15) +FNF:15 +FNH:0 +FNDA:0,(anonymous_1) +FNDA:0,(anonymous_2) +FNDA:0,(anonymous_3) +FNDA:0,(anonymous_4) +FNDA:0,(anonymous_5) +FNDA:0,(anonymous_6) +FNDA:0,(anonymous_7) +FNDA:0,(anonymous_8) +FNDA:0,(anonymous_9) +FNDA:0,(anonymous_10) +FNDA:0,(anonymous_11) +FNDA:0,(anonymous_12) +FNDA:0,(anonymous_13) +FNDA:0,(anonymous_14) +FNDA:0,(anonymous_15) +DA:6,1 +DA:20,1 +DA:47,1 +DA:122,1 +DA:129,1 +DA:131,0 +DA:133,0 +DA:134,0 +DA:135,0 +DA:143,0 +DA:147,0 +DA:148,0 +DA:149,0 +DA:152,0 +DA:154,0 +DA:163,0 +DA:164,0 +DA:165,0 +DA:166,0 +DA:168,0 +DA:169,0 +DA:170,0 +DA:172,0 +DA:173,0 +DA:174,0 +DA:175,0 +DA:176,0 +DA:177,0 +DA:178,0 +DA:181,0 +DA:182,0 +DA:183,0 +DA:184,0 +DA:187,0 +DA:189,0 +DA:190,0 +DA:193,0 +DA:194,0 +DA:195,0 +DA:196,0 +DA:197,0 +DA:204,0 +DA:205,0 +DA:206,0 +DA:208,0 +DA:209,0 +DA:211,0 +DA:212,0 +DA:219,0 +DA:221,0 +DA:222,0 +DA:223,0 +DA:226,0 +DA:230,0 +DA:236,1 +DA:237,0 +DA:238,0 +DA:239,0 +DA:240,0 +DA:241,0 +DA:242,0 +DA:243,0 +DA:247,0 +DA:251,1 +DA:252,0 +DA:257,0 +DA:258,0 +DA:259,0 +DA:260,0 +DA:262,0 +DA:264,0 +DA:265,0 +DA:266,0 +DA:267,0 +DA:269,0 +DA:270,0 +DA:273,0 +DA:277,1 +LF:78 +LH:8 +BRDA:133,1,0,0 +BRDA:133,1,1,0 +BRDA:143,2,0,0 +BRDA:143,2,1,0 +BRDA:147,3,0,0 +BRDA:147,3,1,0 +BRDA:147,4,0,0 +BRDA:147,4,1,0 +BRDA:147,4,2,0 +BRDA:172,5,0,0 +BRDA:172,5,1,0 +BRDA:174,6,0,0 +BRDA:174,6,1,0 +BRDA:195,7,0,0 +BRDA:195,7,1,0 +BRDA:204,8,0,0 +BRDA:204,8,1,0 +BRDA:211,9,0,0 +BRDA:211,9,1,0 +BRDA:219,10,0,0 +BRDA:219,10,1,0 +BRDA:238,11,0,0 +BRDA:238,11,1,0 +BRDA:239,12,0,0 +BRDA:239,12,1,0 +BRDA:239,13,0,0 +BRDA:239,13,1,0 +BRDA:241,14,0,0 +BRDA:241,14,1,0 +BRDA:257,15,0,0 +BRDA:257,15,1,0 +BRDA:257,16,0,0 +BRDA:257,16,1,0 +BRDA:265,17,0,0 +BRDA:265,17,1,0 +BRF:35 +BRH:0 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/scripts/oscarhost/OscarSecurity.js +FN:6,WSSecurity +FN:11,(anonymous_2) +FNF:2 +FNH:0 +FNDA:0,WSSecurity +FNDA:0,(anonymous_2) +DA:3,1 +DA:6,1 +DA:7,0 +DA:8,0 +DA:11,1 +DA:12,0 +DA:14,0 +DA:23,1 +LF:8 +LH:4 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/app/models/form.server.model.js +FN:198,(anonymous_1) +FN:219,(anonymous_2) +FN:222,(anonymous_3) +FN:232,(anonymous_4) +FN:235,(anonymous_5) +FN:248,getDeletedIndexes +FN:262,(anonymous_7) +FN:266,(anonymous_8) +FN:284,(anonymous_9) +FN:300,(anonymous_10) +FN:317,(anonymous_11) +FN:352,(anonymous_12) +FN:363,(anonymous_13) +FN:372,(anonymous_14) +FN:382,(anonymous_15) +FN:383,(anonymous_16) +FN:400,(anonymous_17) +FN:407,(anonymous_18) +FN:425,(anonymous_19) +FN:435,(anonymous_20) +FN:441,(anonymous_21) +FN:465,(anonymous_22) +FN:469,(anonymous_23) +FNF:23 +FNH:3 +FNDA:0,(anonymous_1) +FNDA:0,(anonymous_2) +FNDA:0,(anonymous_3) +FNDA:1,(anonymous_4) +FNDA:1,(anonymous_5) +FNDA:0,getDeletedIndexes +FNDA:1,(anonymous_7) +FNDA:0,(anonymous_8) +FNDA:0,(anonymous_9) +FNDA:0,(anonymous_10) +FNDA:0,(anonymous_11) +FNDA:0,(anonymous_12) +FNDA:0,(anonymous_13) +FNDA:0,(anonymous_14) +FNDA:0,(anonymous_15) +FNDA:0,(anonymous_16) +FNDA:0,(anonymous_17) +FNDA:0,(anonymous_18) +FNDA:0,(anonymous_19) +FNDA:0,(anonymous_20) +FNDA:0,(anonymous_21) +FNDA:0,(anonymous_22) +FNDA:0,(anonymous_23) +DA:6,1 +DA:18,1 +DA:19,1 +DA:21,1 +DA:25,1 +DA:47,1 +DA:193,1 +DA:198,1 +DA:199,0 +DA:200,0 +DA:216,0 +DA:219,1 +DA:220,0 +DA:222,0 +DA:223,0 +DA:224,0 +DA:229,1 +DA:232,1 +DA:234,1 +DA:236,1 +DA:237,0 +DA:238,0 +DA:240,1 +DA:243,1 +DA:248,1 +DA:249,0 +DA:251,0 +DA:252,0 +DA:253,0 +DA:254,0 +DA:258,0 +DA:262,1 +DA:263,1 +DA:264,0 +DA:265,0 +DA:267,0 +DA:269,0 +DA:271,0 +DA:274,0 +DA:275,0 +DA:277,0 +DA:279,0 +DA:280,0 +DA:283,0 +DA:284,0 +DA:285,0 +DA:286,0 +DA:287,0 +DA:289,0 +DA:290,0 +DA:292,0 +DA:296,0 +DA:301,0 +DA:302,0 +DA:303,0 +DA:304,0 +DA:317,0 +DA:318,0 +DA:319,0 +DA:320,0 +DA:321,0 +DA:325,0 +DA:326,0 +DA:329,0 +DA:330,0 +DA:334,0 +DA:335,0 +DA:341,0 +DA:345,0 +DA:346,0 +DA:349,0 +DA:353,0 +DA:354,0 +DA:358,0 +DA:359,0 +DA:362,1 +DA:363,0 +DA:364,0 +DA:365,0 +DA:366,0 +DA:369,0 +DA:372,1 +DA:379,0 +DA:381,0 +DA:382,0 +DA:383,0 +DA:395,0 +DA:397,0 +DA:399,0 +DA:402,0 +DA:405,0 +DA:408,0 +DA:409,0 +DA:410,0 +DA:414,0 +DA:418,0 +DA:421,0 +DA:426,0 +DA:427,0 +DA:428,0 +DA:435,0 +DA:438,0 +DA:441,0 +DA:442,0 +DA:443,0 +DA:446,0 +DA:449,0 +DA:453,0 +DA:455,0 +DA:458,0 +DA:459,0 +DA:465,0 +DA:466,0 +DA:467,0 +DA:470,0 +DA:471,0 +DA:472,0 +DA:476,0 +DA:481,0 +DA:484,0 +DA:489,1 +LF:121 +LH:21 +BRDA:220,1,0,0 +BRDA:220,1,1,0 +BRDA:220,2,0,0 +BRDA:220,2,1,0 +BRDA:223,3,0,0 +BRDA:223,3,1,0 +BRDA:236,4,0,0 +BRDA:236,4,1,1 +BRDA:251,5,0,0 +BRDA:251,5,1,0 +BRDA:253,6,0,0 +BRDA:253,6,1,0 +BRDA:263,7,0,0 +BRDA:263,7,1,1 +BRDA:267,8,0,0 +BRDA:267,8,1,0 +BRDA:267,9,0,0 +BRDA:267,9,1,0 +BRDA:279,10,0,0 +BRDA:279,10,1,0 +BRDA:279,11,0,0 +BRDA:279,11,1,0 +BRDA:285,12,0,0 +BRDA:285,12,1,0 +BRDA:301,13,0,0 +BRDA:301,13,1,0 +BRDA:318,14,0,0 +BRDA:318,14,1,0 +BRDA:320,15,0,0 +BRDA:320,15,1,0 +BRDA:320,16,0,0 +BRDA:320,16,1,0 +BRDA:320,16,2,0 +BRDA:329,17,0,0 +BRDA:329,17,1,0 +BRDA:353,18,0,0 +BRDA:353,18,1,0 +BRDA:362,19,0,0 +BRDA:362,19,1,0 +BRDA:364,20,0,0 +BRDA:364,20,1,0 +BRDA:379,21,0,0 +BRDA:379,21,1,0 +BRDA:379,22,0,0 +BRDA:379,22,1,0 +BRDA:379,22,2,0 +BRDA:395,23,0,0 +BRDA:395,23,1,0 +BRDA:408,24,0,0 +BRDA:408,24,1,0 +BRDA:414,25,0,0 +BRDA:414,25,1,0 +BRDA:426,26,0,0 +BRDA:426,26,1,0 +BRDA:449,27,0,0 +BRDA:449,27,1,0 +BRDA:466,28,0,0 +BRDA:466,28,1,0 +BRDA:470,29,0,0 +BRDA:470,29,1,0 +BRF:60 +BRH:2 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/app/models/logic_jump.server.model.js +FN:22,(anonymous_1) +FN:30,(anonymous_2) +FN:34,(anonymous_3) +FNF:3 +FNH:0 +FNDA:0,(anonymous_1) +FNDA:0,(anonymous_2) +FNDA:0,(anonymous_3) +DA:6,1 +DA:12,1 +DA:22,1 +DA:25,0 +DA:26,0 +DA:27,0 +DA:30,0 +DA:31,0 +DA:33,0 +DA:35,0 +DA:36,0 +DA:37,0 +DA:40,0 +DA:41,0 +DA:43,0 +DA:45,0 +DA:46,0 +DA:51,0 +DA:52,0 +DA:54,0 +DA:55,0 +DA:58,1 +DA:62,1 +DA:78,1 +LF:24 +LH:6 +BRDA:31,1,0,0 +BRDA:31,1,1,0 +BRDA:35,2,0,0 +BRDA:35,2,1,0 +BRDA:40,3,0,0 +BRDA:40,3,1,0 +BRF:6 +BRH:0 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/app/models/user.server.model.js +FN:17,(anonymous_1) +FN:24,(anonymous_2) +FN:102,(anonymous_3) +FN:113,(anonymous_4) +FN:137,(anonymous_5) +FN:140,(anonymous_6) +FN:148,(anonymous_7) +FN:164,(anonymous_8) +FN:171,(anonymous_9) +FN:177,(anonymous_10) +FN:193,(anonymous_11) +FNF:11 +FNH:6 +FNDA:32,(anonymous_1) +FNDA:0,(anonymous_2) +FNDA:0,(anonymous_3) +FNDA:7,(anonymous_4) +FNDA:15,(anonymous_5) +FNDA:0,(anonymous_6) +FNDA:15,(anonymous_7) +FNDA:0,(anonymous_8) +FNDA:2,(anonymous_9) +FNDA:2,(anonymous_10) +FNDA:0,(anonymous_11) +DA:6,1 +DA:17,1 +DA:18,32 +DA:24,1 +DA:25,0 +DA:31,1 +DA:102,1 +DA:103,0 +DA:106,1 +DA:113,1 +DA:114,7 +DA:115,7 +DA:116,0 +DA:119,0 +DA:120,0 +DA:122,0 +DA:124,0 +DA:126,0 +DA:128,0 +DA:131,7 +DA:137,1 +DA:138,15 +DA:140,1 +DA:141,0 +DA:148,1 +DA:150,15 +DA:151,15 +DA:154,15 +DA:155,15 +DA:157,0 +DA:164,1 +DA:165,0 +DA:171,1 +DA:172,2 +DA:173,2 +DA:175,2 +DA:178,2 +DA:179,2 +DA:180,1 +DA:182,1 +DA:185,0 +DA:193,1 +DA:194,0 +DA:195,0 +DA:197,0 +DA:200,1 +LF:46 +LH:30 +BRDA:18,1,0,32 +BRDA:18,1,1,0 +BRDA:18,1,2,32 +BRDA:25,2,0,0 +BRDA:25,2,1,0 +BRDA:25,2,2,0 +BRDA:115,3,0,0 +BRDA:115,3,1,7 +BRDA:124,4,0,0 +BRDA:124,4,1,0 +BRDA:124,5,0,0 +BRDA:124,5,1,0 +BRDA:150,6,0,15 +BRDA:150,6,1,0 +BRDA:154,7,0,15 +BRDA:154,7,1,0 +BRDA:173,8,0,2 +BRDA:173,8,1,1 +BRDA:178,9,0,2 +BRDA:178,9,1,0 +BRDA:179,10,0,1 +BRDA:179,10,1,1 +BRDA:182,11,0,1 +BRDA:182,11,1,1 +BRDA:194,12,0,0 +BRDA:194,12,1,0 +BRF:26 +BRH:12 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/app/routes/core.server.routes.js +FN:3,(anonymous_1) +FNF:1 +FNH:1 +FNDA:1,(anonymous_1) +DA:3,1 +DA:5,1 +DA:6,1 +LF:3 +LH:3 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/app/controllers/core.server.controller.js +FN:8,(anonymous_1) +FNF:1 +FNH:0 +FNDA:0,(anonymous_1) +DA:3,1 +DA:8,1 +DA:9,0 +LF:3 +LH:2 +BRDA:10,1,0,0 +BRDA:10,1,1,0 +BRF:2 +BRH:0 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/app/routes/forms.server.routes.js +FN:13,(anonymous_1) +FN:16,(anonymous_2) +FN:20,(anonymous_3) +FN:25,(anonymous_4) +FNF:4 +FNH:1 +FNDA:0,(anonymous_1) +FNDA:0,(anonymous_2) +FNDA:0,(anonymous_3) +FNDA:1,(anonymous_4) +DA:6,1 +DA:12,1 +DA:14,0 +DA:18,0 +DA:21,0 +DA:25,1 +DA:27,1 +DA:30,1 +DA:34,1 +DA:40,1 +DA:45,1 +LF:11 +LH:8 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/app/controllers/users.server.controller.js +FNF:0 +FNH:0 +DA:6,1 +DA:11,1 +LF:2 +LH:2 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/app/controllers/users/users.authentication.server.controller.js +FN:19,(anonymous_1) +FN:44,(anonymous_2) +FN:60,(anonymous_3) +FN:61,(anonymous_4) +FN:75,(anonymous_5) +FN:76,(anonymous_6) +FN:96,(anonymous_7) +FN:108,(anonymous_8) +FN:120,(anonymous_9) +FN:143,(anonymous_10) +FN:144,(anonymous_11) +FN:153,(anonymous_12) +FN:169,(anonymous_13) +FN:178,(anonymous_14) +FN:179,(anonymous_15) +FN:180,(anonymous_16) +FN:184,(anonymous_17) +FN:198,(anonymous_18) +FN:218,(anonymous_19) +FN:225,(anonymous_20) +FN:237,(anonymous_21) +FN:260,(anonymous_22) +FN:272,(anonymous_23) +FN:285,(anonymous_24) +FN:291,(anonymous_25) +FNF:25 +FNH:9 +FNDA:1,(anonymous_1) +FNDA:1,(anonymous_2) +FNDA:1,(anonymous_3) +FNDA:1,(anonymous_4) +FNDA:0,(anonymous_5) +FNDA:0,(anonymous_6) +FNDA:2,(anonymous_7) +FNDA:2,(anonymous_8) +FNDA:2,(anonymous_9) +FNDA:1,(anonymous_10) +FNDA:1,(anonymous_11) +FNDA:0,(anonymous_12) +FNDA:0,(anonymous_13) +FNDA:0,(anonymous_14) +FNDA:0,(anonymous_15) +FNDA:0,(anonymous_16) +FNDA:0,(anonymous_17) +FNDA:0,(anonymous_18) +FNDA:0,(anonymous_19) +FNDA:0,(anonymous_20) +FNDA:0,(anonymous_21) +FNDA:0,(anonymous_22) +FNDA:0,(anonymous_23) +FNDA:0,(anonymous_24) +FNDA:0,(anonymous_25) +DA:6,1 +DA:16,1 +DA:19,1 +DA:21,1 +DA:23,1 +DA:45,1 +DA:46,0 +DA:48,1 +DA:53,1 +DA:56,1 +DA:58,1 +DA:60,1 +DA:61,1 +DA:62,1 +DA:63,0 +DA:64,0 +DA:66,1 +DA:67,0 +DA:70,1 +DA:75,1 +DA:76,0 +DA:77,0 +DA:78,0 +DA:79,0 +DA:82,0 +DA:83,0 +DA:84,0 +DA:87,0 +DA:96,1 +DA:98,2 +DA:101,2 +DA:104,2 +DA:105,2 +DA:108,2 +DA:110,2 +DA:111,0 +DA:112,0 +DA:113,0 +DA:119,2 +DA:120,2 +DA:121,2 +DA:122,0 +DA:123,0 +DA:124,0 +DA:128,2 +DA:129,2 +DA:133,0 +DA:134,0 +DA:143,1 +DA:144,1 +DA:145,1 +DA:146,1 +DA:149,0 +DA:150,0 +DA:151,0 +DA:153,0 +DA:154,0 +DA:155,0 +DA:159,0 +DA:169,1 +DA:170,0 +DA:171,0 +DA:172,0 +DA:178,1 +DA:179,0 +DA:180,0 +DA:181,0 +DA:182,0 +DA:184,0 +DA:185,0 +DA:186,0 +DA:189,0 +DA:198,1 +DA:199,0 +DA:201,0 +DA:202,0 +DA:205,0 +DA:206,0 +DA:207,0 +DA:210,0 +DA:211,0 +DA:214,0 +DA:218,0 +DA:219,0 +DA:220,0 +DA:222,0 +DA:223,0 +DA:225,0 +DA:226,0 +DA:237,0 +DA:238,0 +DA:242,0 +DA:248,0 +DA:251,0 +DA:253,0 +DA:254,0 +DA:257,0 +DA:260,0 +DA:261,0 +DA:264,0 +DA:272,1 +DA:273,0 +DA:274,0 +DA:276,0 +DA:278,0 +DA:279,0 +DA:282,0 +DA:285,0 +DA:286,0 +DA:287,0 +DA:291,0 +DA:292,0 +DA:293,0 +DA:295,0 +LF:114 +LH:36 +BRDA:45,1,0,0 +BRDA:45,1,1,1 +BRDA:62,2,0,0 +BRDA:62,2,1,1 +BRDA:66,3,0,0 +BRDA:66,3,1,1 +BRDA:77,4,0,0 +BRDA:77,4,1,0 +BRDA:82,5,0,0 +BRDA:82,5,1,0 +BRDA:110,6,0,0 +BRDA:110,6,1,2 +BRDA:119,7,0,2 +BRDA:119,7,1,0 +BRDA:121,8,0,0 +BRDA:121,8,1,2 +BRDA:145,9,0,1 +BRDA:145,9,1,0 +BRDA:145,10,0,1 +BRDA:145,10,1,1 +BRDA:154,11,0,0 +BRDA:154,11,1,0 +BRDA:181,12,0,0 +BRDA:181,12,1,0 +BRDA:181,13,0,0 +BRDA:181,13,1,0 +BRDA:185,14,0,0 +BRDA:185,14,1,0 +BRDA:189,15,0,0 +BRDA:189,15,1,0 +BRDA:199,16,0,0 +BRDA:199,16,1,0 +BRDA:219,17,0,0 +BRDA:219,17,1,0 +BRDA:222,18,0,0 +BRDA:222,18,1,0 +BRDA:223,19,0,0 +BRDA:223,19,1,0 +BRDA:223,20,0,0 +BRDA:223,20,1,0 +BRDA:251,21,0,0 +BRDA:251,21,1,0 +BRDA:251,22,0,0 +BRDA:251,22,1,0 +BRDA:251,22,2,0 +BRDA:253,23,0,0 +BRDA:253,23,1,0 +BRDA:276,24,0,0 +BRDA:276,24,1,0 +BRDA:276,25,0,0 +BRDA:276,25,1,0 +BRDA:278,26,0,0 +BRDA:278,26,1,0 +BRDA:286,27,0,0 +BRDA:286,27,1,0 +BRDA:292,28,0,0 +BRDA:292,28,1,0 +BRF:57 +BRH:9 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/app/controllers/errors.server.controller.js +FN:6,(anonymous_1) +FN:23,(anonymous_2) +FNF:2 +FNH:0 +FNDA:0,(anonymous_1) +FNDA:0,(anonymous_2) +DA:6,1 +DA:7,0 +DA:9,0 +DA:10,0 +DA:11,0 +DA:14,0 +DA:17,0 +DA:23,1 +DA:24,0 +DA:26,0 +DA:27,0 +DA:30,0 +DA:31,0 +DA:33,0 +DA:36,0 +DA:37,0 +DA:41,0 +LF:17 +LH:2 +BRDA:26,1,0,0 +BRDA:26,1,1,0 +BRDA:27,2,0,0 +BRDA:27,2,1,0 +BRDA:27,2,2,0 +BRDA:37,3,0,0 +BRDA:37,3,1,0 +BRF:7 +BRH:0 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/app/controllers/users/users.authorization.server.controller.js +FN:13,(anonymous_1) +FN:22,(anonymous_2) +FN:37,(anonymous_3) +FN:50,(anonymous_4) +FN:53,(anonymous_5) +FN:54,(anonymous_6) +FNF:6 +FNH:0 +FNDA:0,(anonymous_1) +FNDA:0,(anonymous_2) +FNDA:0,(anonymous_3) +FNDA:0,(anonymous_4) +FNDA:0,(anonymous_5) +FNDA:0,(anonymous_6) +DA:6,1 +DA:13,1 +DA:14,0 +DA:15,0 +DA:20,0 +DA:23,0 +DA:24,0 +DA:25,0 +DA:26,0 +DA:29,0 +DA:30,0 +DA:37,1 +DA:38,0 +DA:39,0 +DA:43,0 +DA:50,1 +DA:51,0 +DA:53,0 +DA:54,0 +DA:55,0 +DA:56,0 +DA:58,0 +LF:22 +LH:4 +BRDA:14,1,0,0 +BRDA:14,1,1,0 +BRDA:23,2,0,0 +BRDA:23,2,1,0 +BRDA:25,3,0,0 +BRDA:25,3,1,0 +BRDA:38,4,0,0 +BRDA:38,4,1,0 +BRDA:55,5,0,0 +BRDA:55,5,1,0 +BRF:10 +BRH:0 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/app/controllers/users/users.password.server.controller.js +FN:21,(anonymous_1) +FN:24,(anonymous_2) +FN:25,(anonymous_3) +FN:31,(anonymous_4) +FN:35,(anonymous_5) +FN:48,(anonymous_6) +FN:59,(anonymous_7) +FN:64,(anonymous_8) +FN:69,(anonymous_9) +FN:76,(anonymous_10) +FN:90,(anonymous_11) +FN:98,(anonymous_12) +FN:104,(anonymous_13) +FN:116,(anonymous_14) +FN:122,(anonymous_15) +FN:128,(anonymous_16) +FN:135,(anonymous_17) +FN:141,(anonymous_18) +FN:165,(anonymous_19) +FN:169,(anonymous_20) +FN:174,(anonymous_21) +FN:182,(anonymous_22) +FN:186,(anonymous_23) +FN:194,(anonymous_24) +FN:200,(anonymous_25) +FN:206,(anonymous_26) +FN:212,(anonymous_27) +FNF:27 +FNH:0 +FNDA:0,(anonymous_1) +FNDA:0,(anonymous_2) +FNDA:0,(anonymous_3) +FNDA:0,(anonymous_4) +FNDA:0,(anonymous_5) +FNDA:0,(anonymous_6) +FNDA:0,(anonymous_7) +FNDA:0,(anonymous_8) +FNDA:0,(anonymous_9) +FNDA:0,(anonymous_10) +FNDA:0,(anonymous_11) +FNDA:0,(anonymous_12) +FNDA:0,(anonymous_13) +FNDA:0,(anonymous_14) +FNDA:0,(anonymous_15) +FNDA:0,(anonymous_16) +FNDA:0,(anonymous_17) +FNDA:0,(anonymous_18) +FNDA:0,(anonymous_19) +FNDA:0,(anonymous_20) +FNDA:0,(anonymous_21) +FNDA:0,(anonymous_22) +FNDA:0,(anonymous_23) +FNDA:0,(anonymous_24) +FNDA:0,(anonymous_25) +FNDA:0,(anonymous_26) +FNDA:0,(anonymous_27) +DA:6,1 +DA:16,1 +DA:21,1 +DA:22,0 +DA:25,0 +DA:26,0 +DA:27,0 +DA:32,0 +DA:33,0 +DA:36,0 +DA:37,0 +DA:40,0 +DA:41,0 +DA:45,0 +DA:46,0 +DA:48,0 +DA:49,0 +DA:54,0 +DA:60,0 +DA:65,0 +DA:70,0 +DA:76,0 +DA:77,0 +DA:78,0 +DA:82,0 +DA:87,0 +DA:91,0 +DA:98,1 +DA:99,0 +DA:105,0 +DA:106,0 +DA:109,0 +DA:116,1 +DA:118,0 +DA:120,0 +DA:123,0 +DA:129,0 +DA:130,0 +DA:131,0 +DA:132,0 +DA:133,0 +DA:135,0 +DA:136,0 +DA:137,0 +DA:141,0 +DA:142,0 +DA:143,0 +DA:146,0 +DA:148,0 +DA:154,0 +DA:159,0 +DA:166,0 +DA:170,0 +DA:175,0 +DA:182,0 +DA:183,0 +DA:187,0 +DA:194,1 +DA:196,0 +DA:198,0 +DA:199,0 +DA:200,0 +DA:201,0 +DA:202,0 +DA:203,0 +DA:204,0 +DA:206,0 +DA:207,0 +DA:208,0 +DA:212,0 +DA:213,0 +DA:214,0 +DA:216,0 +DA:224,0 +DA:229,0 +DA:234,0 +DA:240,0 +DA:245,0 +LF:78 +LH:6 +BRDA:32,1,0,0 +BRDA:32,1,1,0 +BRDA:36,2,0,0 +BRDA:36,2,1,0 +BRDA:40,3,0,0 +BRDA:40,3,1,0 +BRDA:77,4,0,0 +BRDA:77,4,1,0 +BRDA:91,5,0,0 +BRDA:91,5,1,0 +BRDA:105,6,0,0 +BRDA:105,6,1,0 +BRDA:129,7,0,0 +BRDA:129,7,1,0 +BRDA:129,8,0,0 +BRDA:129,8,1,0 +BRDA:130,9,0,0 +BRDA:130,9,1,0 +BRDA:136,10,0,0 +BRDA:136,10,1,0 +BRDA:142,11,0,0 +BRDA:142,11,1,0 +BRDA:187,12,0,0 +BRDA:187,12,1,0 +BRDA:198,13,0,0 +BRDA:198,13,1,0 +BRDA:199,14,0,0 +BRDA:199,14,1,0 +BRDA:201,15,0,0 +BRDA:201,15,1,0 +BRDA:201,16,0,0 +BRDA:201,16,1,0 +BRDA:202,17,0,0 +BRDA:202,17,1,0 +BRDA:203,18,0,0 +BRDA:203,18,1,0 +BRDA:207,19,0,0 +BRDA:207,19,1,0 +BRDA:213,20,0,0 +BRDA:213,20,1,0 +BRF:40 +BRH:0 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/app/controllers/users/users.profile.server.controller.js +FN:15,(anonymous_1) +FN:29,(anonymous_2) +FN:35,(anonymous_3) +FN:54,(anonymous_4) +FNF:4 +FNH:0 +FNDA:0,(anonymous_1) +FNDA:0,(anonymous_2) +FNDA:0,(anonymous_3) +FNDA:0,(anonymous_4) +DA:6,1 +DA:15,1 +DA:17,0 +DA:18,0 +DA:21,0 +DA:23,0 +DA:25,0 +DA:26,0 +DA:29,0 +DA:30,0 +DA:31,0 +DA:35,0 +DA:36,0 +DA:37,0 +DA:39,0 +DA:45,0 +DA:54,1 +DA:55,0 +DA:56,0 +DA:57,0 +DA:58,0 +DA:59,0 +DA:61,0 +DA:63,0 +LF:24 +LH:3 +BRDA:23,1,0,0 +BRDA:23,1,1,0 +BRDA:30,2,0,0 +BRDA:30,2,1,0 +BRDA:36,3,0,0 +BRDA:36,3,1,0 +BRDA:61,4,0,0 +BRDA:61,4,1,0 +BRF:8 +BRH:0 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/app/controllers/forms.server.controller.js +FN:20,(anonymous_1) +FN:36,(anonymous_2) +FN:52,(anonymous_3) +FN:74,(anonymous_4) +FN:80,(anonymous_5) +FN:95,(anonymous_6) +FN:136,(anonymous_7) +FN:151,(anonymous_8) +FN:156,(anonymous_9) +FN:164,(anonymous_10) +FN:181,(anonymous_11) +FN:190,(anonymous_12) +FN:205,(anonymous_13) +FN:216,(anonymous_14) +FN:235,(anonymous_15) +FN:250,(anonymous_16) +FN:253,(anonymous_17) +FN:269,(anonymous_18) +FN:274,(anonymous_19) +FN:288,(anonymous_20) +FN:296,(anonymous_21) +FN:320,(anonymous_22) +FNF:22 +FNH:0 +FNDA:0,(anonymous_1) +FNDA:0,(anonymous_2) +FNDA:0,(anonymous_3) +FNDA:0,(anonymous_4) +FNDA:0,(anonymous_5) +FNDA:0,(anonymous_6) +FNDA:0,(anonymous_7) +FNDA:0,(anonymous_8) +FNDA:0,(anonymous_9) +FNDA:0,(anonymous_10) +FNDA:0,(anonymous_11) +FNDA:0,(anonymous_12) +FNDA:0,(anonymous_13) +FNDA:0,(anonymous_14) +FNDA:0,(anonymous_15) +FNDA:0,(anonymous_16) +FNDA:0,(anonymous_17) +FNDA:0,(anonymous_18) +FNDA:0,(anonymous_19) +FNDA:0,(anonymous_20) +FNDA:0,(anonymous_21) +FNDA:0,(anonymous_22) +DA:6,1 +DA:20,1 +DA:28,0 +DA:29,0 +DA:30,0 +DA:31,0 +DA:32,0 +DA:33,0 +DA:34,0 +DA:36,0 +DA:38,0 +DA:40,0 +DA:41,0 +DA:42,0 +DA:43,0 +DA:45,0 +DA:47,0 +DA:48,0 +DA:49,0 +DA:52,0 +DA:53,0 +DA:54,0 +DA:56,0 +DA:57,0 +DA:58,0 +DA:62,0 +DA:67,0 +DA:74,1 +DA:75,0 +DA:77,0 +DA:80,0 +DA:82,0 +DA:83,0 +DA:88,0 +DA:95,1 +DA:97,0 +DA:101,0 +DA:110,0 +DA:112,0 +DA:115,0 +DA:116,0 +DA:117,0 +DA:120,0 +DA:121,0 +DA:124,0 +DA:125,0 +DA:126,0 +DA:128,0 +DA:133,0 +DA:136,0 +DA:138,0 +DA:139,0 +DA:140,0 +DA:144,0 +DA:151,1 +DA:152,0 +DA:153,0 +DA:154,0 +DA:156,0 +DA:157,0 +DA:158,0 +DA:159,0 +DA:164,0 +DA:165,0 +DA:166,0 +DA:167,0 +DA:171,0 +DA:181,1 +DA:182,0 +DA:184,0 +DA:190,0 +DA:191,0 +DA:192,0 +DA:193,0 +DA:197,0 +DA:205,1 +DA:206,0 +DA:208,0 +DA:209,0 +DA:210,0 +DA:216,1 +DA:217,0 +DA:218,0 +DA:219,0 +DA:222,0 +DA:225,0 +DA:226,0 +DA:227,0 +DA:228,0 +DA:229,0 +DA:233,0 +DA:235,0 +DA:236,0 +DA:237,0 +DA:238,0 +DA:242,0 +DA:250,1 +DA:251,0 +DA:253,0 +DA:254,0 +DA:255,0 +DA:261,0 +DA:269,1 +DA:271,0 +DA:272,0 +DA:274,0 +DA:275,0 +DA:276,0 +DA:280,0 +DA:288,1 +DA:290,0 +DA:291,0 +DA:296,0 +DA:297,0 +DA:298,0 +DA:299,0 +DA:300,0 +DA:306,0 +DA:307,0 +DA:308,0 +DA:310,0 +DA:311,0 +DA:320,1 +DA:322,0 +DA:323,0 +DA:324,0 +DA:328,0 +LF:127 +LH:12 +BRDA:28,1,0,0 +BRDA:28,1,1,0 +BRDA:31,2,0,0 +BRDA:31,2,1,0 +BRDA:33,3,0,0 +BRDA:33,3,1,0 +BRDA:38,4,0,0 +BRDA:38,4,1,0 +BRDA:47,5,0,0 +BRDA:47,5,1,0 +BRDA:47,6,0,0 +BRDA:47,6,1,0 +BRDA:53,7,0,0 +BRDA:53,7,1,0 +BRDA:82,8,0,0 +BRDA:82,8,1,0 +BRDA:110,9,0,0 +BRDA:110,9,1,0 +BRDA:112,10,0,0 +BRDA:112,10,1,0 +BRDA:115,11,0,0 +BRDA:115,11,1,0 +BRDA:115,12,0,0 +BRDA:115,12,1,0 +BRDA:116,13,0,0 +BRDA:116,13,1,0 +BRDA:117,14,0,0 +BRDA:117,14,1,0 +BRDA:117,15,0,0 +BRDA:117,15,1,0 +BRDA:120,16,0,0 +BRDA:120,16,1,0 +BRDA:124,17,0,0 +BRDA:124,17,1,0 +BRDA:138,18,0,0 +BRDA:138,18,1,0 +BRDA:157,19,0,0 +BRDA:157,19,1,0 +BRDA:165,20,0,0 +BRDA:165,20,1,0 +BRDA:191,21,0,0 +BRDA:191,21,1,0 +BRDA:222,22,0,0 +BRDA:222,22,1,0 +BRDA:228,23,0,0 +BRDA:228,23,1,0 +BRDA:236,24,0,0 +BRDA:236,24,1,0 +BRDA:254,25,0,0 +BRDA:254,25,1,0 +BRDA:272,26,0,0 +BRDA:272,26,1,0 +BRDA:275,27,0,0 +BRDA:275,27,1,0 +BRDA:290,28,0,0 +BRDA:290,28,1,0 +BRDA:297,29,0,0 +BRDA:297,29,1,0 +BRDA:299,30,0,0 +BRDA:299,30,1,0 +BRDA:299,31,0,0 +BRDA:299,31,1,0 +BRDA:323,32,0,0 +BRDA:323,32,1,0 +BRDA:323,33,0,0 +BRDA:323,33,1,0 +BRF:66 +BRH:0 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/app/routes/users.server.routes.js +FN:8,(anonymous_1) +FNF:1 +FNH:1 +FNDA:1,(anonymous_1) +DA:6,1 +DA:8,1 +DA:10,1 +DA:13,1 +DA:14,1 +DA:15,1 +DA:18,1 +DA:19,1 +DA:22,1 +DA:23,1 +DA:24,1 +DA:25,1 +DA:28,1 +DA:29,1 +DA:30,1 +DA:60,1 +LF:16 +LH:16 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/config/passport.js +FN:14,(anonymous_1) +FN:16,(anonymous_2) +FN:21,(anonymous_3) +FN:24,(anonymous_4) +FN:30,(anonymous_5) +FNF:5 +FNH:2 +FNDA:1,(anonymous_1) +FNDA:0,(anonymous_2) +FNDA:0,(anonymous_3) +FNDA:0,(anonymous_4) +FNDA:6,(anonymous_5) +DA:6,1 +DA:14,1 +DA:16,1 +DA:17,0 +DA:21,1 +DA:22,0 +DA:25,0 +DA:30,1 +DA:31,6 +LF:9 +LH:6 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/config/strategies/facebook.js +FN:11,(anonymous_1) +FN:19,(anonymous_2) +FNF:2 +FNH:1 +FNDA:1,(anonymous_1) +FNDA:0,(anonymous_2) +DA:6,1 +DA:11,1 +DA:13,1 +DA:21,0 +DA:22,0 +DA:23,0 +DA:26,0 +DA:38,0 +LF:8 +LH:3 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/config/strategies/github.js +FN:11,(anonymous_1) +FN:19,(anonymous_2) +FNF:2 +FNH:1 +FNDA:1,(anonymous_1) +FNDA:0,(anonymous_2) +DA:6,1 +DA:11,1 +DA:13,1 +DA:21,0 +DA:22,0 +DA:23,0 +DA:26,0 +DA:27,0 +DA:28,0 +DA:29,0 +DA:31,0 +DA:43,0 +LF:12 +LH:3 +BRDA:28,1,0,0 +BRDA:28,1,1,0 +BRDA:29,2,0,0 +BRDA:29,2,1,0 +BRF:4 +BRH:0 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/config/strategies/google.js +FN:11,(anonymous_1) +FN:19,(anonymous_2) +FNF:2 +FNH:1 +FNDA:1,(anonymous_1) +FNDA:0,(anonymous_2) +DA:6,1 +DA:11,1 +DA:13,1 +DA:21,0 +DA:22,0 +DA:23,0 +DA:26,0 +DA:38,0 +LF:8 +LH:3 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/config/strategies/linkedin.js +FN:11,(anonymous_1) +FN:20,(anonymous_2) +FNF:2 +FNH:1 +FNDA:1,(anonymous_1) +FNDA:0,(anonymous_2) +DA:6,1 +DA:11,1 +DA:13,1 +DA:22,0 +DA:23,0 +DA:24,0 +DA:27,0 +DA:39,0 +LF:8 +LH:3 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/config/strategies/local.js +FN:10,(anonymous_1) +FN:16,(anonymous_2) +FN:19,(anonymous_3) +FNF:3 +FNH:3 +FNDA:1,(anonymous_1) +FNDA:1,(anonymous_2) +FNDA:1,(anonymous_3) +DA:6,1 +DA:10,1 +DA:12,1 +DA:17,1 +DA:20,1 +DA:21,0 +DA:23,1 +DA:24,1 +DA:28,0 +DA:29,0 +DA:34,0 +LF:11 +LH:7 +BRDA:20,1,0,0 +BRDA:20,1,1,1 +BRDA:23,2,0,1 +BRDA:23,2,1,0 +BRDA:28,3,0,0 +BRDA:28,3,1,0 +BRF:6 +BRH:2 +end_of_record +TN: +SF:/Volumes/untitled/Dev/KMC Contracting/kiosk_form/config/strategies/twitter.js +FN:11,(anonymous_1) +FN:19,(anonymous_2) +FNF:2 +FNH:1 +FNDA:1,(anonymous_1) +FNDA:0,(anonymous_2) +DA:6,1 +DA:11,1 +DA:13,1 +DA:21,0 +DA:22,0 +DA:23,0 +DA:26,0 +DA:27,0 +DA:28,0 +DA:29,0 +DA:31,0 +DA:42,0 +LF:12 +LH:3 +BRDA:28,1,0,0 +BRDA:28,1,1,0 +BRDA:29,2,0,0 +BRDA:29,2,1,0 +BRF:4 +BRH:0 +end_of_record diff --git a/gruntfile.js b/gruntfile.js index e590812c..806a9ad5 100755 --- a/gruntfile.js +++ b/gruntfile.js @@ -144,7 +144,7 @@ module.exports = function(grunt) { } }, mochaTest: { - src: watchFiles.mochaTests, + src: watchFiles.serverTests, options: { reporter: 'spec', quiet: false, @@ -173,7 +173,8 @@ module.exports = function(grunt) { coverage: { src: watchFiles.allTests, // a folder works nicely options: { - mask: '*.test.js' + mask: '*.test.js', + require: ['server.js'], } }, coverageClient: { @@ -181,6 +182,7 @@ module.exports = function(grunt) { options: { coverageFolder: 'coverageClient', mask: '*.test.js', + require: ['server.js'], } }, coverageServer: { @@ -188,12 +190,14 @@ module.exports = function(grunt) { options: { coverageFolder: 'coverageServer', mask: '*.test.js', + require: ['server.js'], } }, coveralls: { src: watchFiles.allTests, // multiple folders also works options: { - coverage:true, // this will make the grunt.event.on('coverage') event listener to be triggered + require: ['server.js'], + coverage: true, // this will make the grunt.event.on('coverage') event listener to be triggered check: { lines: 75, statements: 75 @@ -265,9 +269,9 @@ module.exports = function(grunt) { // Code coverage tasks. grunt.registerTask('coveralls', ['mocha_istanbul:coveralls']); - grunt.registerTask('coverage', ['mocha_istanbul:coverage']); - grunt.registerTask('coverage:client', ['mocha_istanbul:coverageClient']); - grunt.registerTask('coverage:server', ['mocha_istanbul:coverageServer']); + grunt.registerTask('coverage', ['env:test', 'mocha_istanbul:coverage']); + grunt.registerTask('coverage:client', ['env:test', 'mocha_istanbul:coverageClient']); + grunt.registerTask('coverage:server', ['env:test', 'mocha_istanbul:coverageServer']); // Default task(s). grunt.registerTask('default', ['lint', 'html2js:main', 'concurrent:default']); diff --git a/package.json b/package.json index 1feefc0b..59884298 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "cookie-parser": "~1.4.0", "email-verification": "whitef0x0/node-email-verification", "express": "~4.13.3", + "express-device": "~0.4.2", "express-session": "~1.12.1", "forever": "~0.15.1", "fs-extra": "~0.26.2", @@ -49,12 +50,12 @@ "grunt-contrib-uglify": "~0.10.0", "grunt-contrib-watch": "~0.6.1", "grunt-env": "~0.4.1", + "grunt-html2js": "~0.3.5", "grunt-karma": "~0.12.1", "grunt-newer": "~1.1.1", "grunt-ng-annotate": "~1.0.1", "grunt-node-inspector": "~0.4.1", "grunt-nodemon": "~0.4.0", - "grunt-html2js": "~0.3.5", "helmet": "~0.14.0", "load-grunt-tasks": "~3.3.0", "lodash": "^2.4.1", @@ -65,6 +66,7 @@ "mongoose-utilities": "~0.1.1", "morgan": "~1.6.1", "multer": "~1.1.0", + "node-freegeoip": "0.0.1", "nodemailer": "~1.8.0", "nools": "^0.4.1", "passport": "~0.3.0", @@ -79,13 +81,11 @@ "raven": "^0.8.1", "request": "^2.60.0", "request-promise": "^1.0.2", - "satelize": "~0.1.1", "shortid": "^2.2.2", "soap": "^0.11.0", "swig": "~1.4.1", "then-fs": "~2.0.0", - "useragent": "~2.1.7", - "express-device": "~0.4.2" + "useragent": "~2.1.7" }, "devDependencies": { "grunt-mocha-istanbul": "^3.0.1",