added node-coveralls to package.json
This commit is contained in:
parent
14c9b00d67
commit
73c87a2301
12
README.md
12
README.md
|
@ -86,11 +86,21 @@ $ grunt test:client
|
||||||
|
|
||||||
Currently the live example uses heroku github deployments. The Docker file is out of date and does not work. If someone wishes to get it working feel free to submit a pull request.
|
Currently the live example uses heroku github deployments. The Docker file is out of date and does not work. If someone wishes to get it working feel free to submit a pull request.
|
||||||
|
|
||||||
To calculate your code coverage with Istanbul, run the coverage task
|
To calculate your total test coverage with Istanbul, run the coverage task
|
||||||
```bash
|
```bash
|
||||||
$ grunt coverage
|
$ grunt coverage
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To calculate your server-side test coverage with Istanbul, run the coverage task
|
||||||
|
```bash
|
||||||
|
$ grunt coverage:server
|
||||||
|
```
|
||||||
|
|
||||||
|
To calculate your client-side test coverage with Istanbul, run the coverage task
|
||||||
|
```bash
|
||||||
|
$ grunt coverage:client
|
||||||
|
```
|
||||||
|
|
||||||
## Running in a secure environment
|
## Running in a secure environment
|
||||||
To run your application in a secure manner you'll need to use OpenSSL and generate a set of self-signed certificates. Unix-based users can use the following command:
|
To run your application in a secure manner you'll need to use OpenSSL and generate a set of self-signed certificates. Unix-based users can use the following command:
|
||||||
```bash
|
```bash
|
||||||
|
|
|
@ -107,7 +107,7 @@ exports.createSubmission = function(req, res) {
|
||||||
percentageComplete: req.body.percentageComplete
|
percentageComplete: req.body.percentageComplete
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!!form.plugins.oscarhost.baseUrl) submission.hasPlugins.oscarhost == true;
|
if(!!form.plugins.oscarhost.baseUrl) submission.hasPlugins.oscarhost = true;
|
||||||
|
|
||||||
if(form.pdf) submission.pdf = form.pdf;
|
if(form.pdf) submission.pdf = form.pdf;
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ exports.update = function(req, res) {
|
||||||
if(req.user.roles.indexOf('admin') === -1) delete req.body.form.admin;
|
if(req.user.roles.indexOf('admin') === -1) delete req.body.form.admin;
|
||||||
|
|
||||||
//Do this so we can create duplicate fields
|
//Do this so we can create duplicate fields
|
||||||
var checkForValidId = new RegExp("^[0-9a-fA-F]{24}$");
|
var checkForValidId = new RegExp('^[0-9a-fA-F]{24}$');
|
||||||
for(var i=0; i<req.body.form.form_fields.length; i++){
|
for(var i=0; i<req.body.form.form_fields.length; i++){
|
||||||
var field = req.body.form.form_fields[i];
|
var field = req.body.form.form_fields[i];
|
||||||
if(!checkForValidId.exec(field._id+'')){
|
if(!checkForValidId.exec(field._id+'')){
|
||||||
|
|
|
@ -359,12 +359,14 @@ FormSchema.pre('save', function (next) {
|
||||||
next();
|
next();
|
||||||
|
|
||||||
});
|
});
|
||||||
}else if(_original.hasOwnProperty('pdf')){
|
}else if(_original){
|
||||||
fs.remove(_original.pdf.path, function (err) {
|
if(_original.hasOwnProperty('pdf')){
|
||||||
if(err) next(err);
|
fs.remove(_original.pdf.path, function (err) {
|
||||||
console.log('file at '+_original.pdf.path+' successfully deleted');
|
if(err) next(err);
|
||||||
next();
|
console.log('file at '+_original.pdf.path+' successfully deleted');
|
||||||
});
|
next();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,39 +20,42 @@ var BooleanExpressionSchema = new Schema({
|
||||||
|
|
||||||
|
|
||||||
BooleanExpressionSchema.methods.evaluate = function(){
|
BooleanExpressionSchema.methods.evaluate = function(){
|
||||||
|
if(this.expressionString)
|
||||||
|
//Get headNode
|
||||||
|
var headNode = math.parse(this.expressionString);
|
||||||
|
var expressionScope = {};
|
||||||
|
var that = this;
|
||||||
|
|
||||||
//Get headNode
|
//Create scope
|
||||||
var headNode = math.parse(expressionString);
|
headNode.traverse(function (node, path, parent) {
|
||||||
var expressionScope = {};
|
if(node.type === 'SymbolNode'){
|
||||||
var that = this;
|
|
||||||
|
|
||||||
//Create scope
|
mongoose.model('Field')
|
||||||
headNode.traverse(function (node, path, parent) {
|
.findOne({_id: node.name}).exec(function(err, field){
|
||||||
if(node.type === 'SymbolNode'){
|
if(err) {
|
||||||
|
console.log(err);
|
||||||
|
throw new Error(err);
|
||||||
|
}
|
||||||
|
|
||||||
mongoose.model('Field')
|
if(!!_.parseInt(field.fieldValue)){
|
||||||
.findOne({_id: node.name}).exec(function(err, field){
|
that.expressionScope[node.name] = _.parseInt(field.fieldValue);
|
||||||
if(err) {
|
}else {
|
||||||
console.log(err);
|
that.expressionScope[node.name] = field.fieldValue;
|
||||||
throw new Error(err);
|
}
|
||||||
}
|
console.log('_id: '+node.name);
|
||||||
|
console.log('value: '+that.expressionScope[node.name]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if(!!_.parseInt(field.fieldValue)){
|
var code = headNode.compile();
|
||||||
that.expressionScope[node.name] = _.parseInt(field.fieldValue);
|
var result = code.eval(expressionScope);
|
||||||
}else {
|
|
||||||
that.expressionScope[node.name] = field.fieldValue;
|
|
||||||
}
|
|
||||||
console.log('_id: '+node.name);
|
|
||||||
console.log('value: '+that.expressionScope[node.name]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var code = headNode.compile();
|
this.result = result;
|
||||||
var result = code.eval(expressionScope);
|
return result;
|
||||||
|
}else{
|
||||||
this.result = result;
|
return null;
|
||||||
return result;
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mongoose.model('BooleanExpression', BooleanExpressionSchema);
|
mongoose.model('BooleanExpression', BooleanExpressionSchema);
|
||||||
|
|
|
@ -39,7 +39,7 @@ var exampleDemo = {
|
||||||
patientStatusDate: Date.now(),
|
patientStatusDate: Date.now(),
|
||||||
phone: '250-',
|
phone: '250-',
|
||||||
phone2: '',
|
phone2: '',
|
||||||
postal: "S4M 7T8",
|
postal: 'S4M 7T8',
|
||||||
providerNo: '4',
|
providerNo: '4',
|
||||||
province: 'BC',
|
province: 'BC',
|
||||||
rosterStatus: '',
|
rosterStatus: '',
|
||||||
|
@ -49,7 +49,7 @@ var exampleDemo = {
|
||||||
spokenLanguage: 'English',
|
spokenLanguage: 'English',
|
||||||
title: 'MS.',
|
title: 'MS.',
|
||||||
yearOfBirth: '2015'
|
yearOfBirth: '2015'
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Globals
|
* Globals
|
||||||
|
|
|
@ -29,7 +29,7 @@ var exampleDemo = {
|
||||||
officialLanguage: 'English',
|
officialLanguage: 'English',
|
||||||
phone: '250-222-2222',
|
phone: '250-222-2222',
|
||||||
phone2: '',
|
phone2: '',
|
||||||
postal: "S4M 7T8",
|
postal: 'S4M 7T8',
|
||||||
province: 'BC',
|
province: 'BC',
|
||||||
sex: 'F',
|
sex: 'F',
|
||||||
sexDesc: 'Female',
|
sexDesc: 'Female',
|
||||||
|
@ -37,7 +37,7 @@ var exampleDemo = {
|
||||||
spokenLanguage: 'English',
|
spokenLanguage: 'English',
|
||||||
title: 'MS.',
|
title: 'MS.',
|
||||||
yearOfBirth: '2015'
|
yearOfBirth: '2015'
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
var sampleFormFields = [
|
var sampleFormFields = [
|
||||||
|
@ -308,6 +308,6 @@ describe('FormSubmission Model Unit Tests:', function() {
|
||||||
User.remove().exec(function() {
|
User.remove().exec(function() {
|
||||||
FormSubmission.remove().exec(done);
|
FormSubmission.remove().exec(done);
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -48,10 +48,11 @@ describe('User CRUD tests', function() {
|
||||||
email: credentials.username,
|
email: credentials.username,
|
||||||
username: credentials.username,
|
username: credentials.username,
|
||||||
password: credentials.password,
|
password: credentials.password,
|
||||||
|
provider: 'local'
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Create, Verify and Activate a User', function() {
|
describe(' > Create, Verify and Activate a User > ', function() {
|
||||||
var username = 'testActiveAccount1.be1e58fb@mailosaur.in';
|
var username = 'testActiveAccount1.be1e58fb@mailosaur.in';
|
||||||
var link, _tmpUser, activateToken;
|
var link, _tmpUser, activateToken;
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
|
@ -124,7 +125,7 @@ describe('User CRUD tests', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to verify a User Account', function(done) {
|
it(' > should be able to verify a User Account', function(done) {
|
||||||
console.log('activateToken: '+activateToken);
|
console.log('activateToken: '+activateToken);
|
||||||
userSession.get('/auth/verify/'+activateToken)
|
userSession.get('/auth/verify/'+activateToken)
|
||||||
.expect(200)
|
.expect(200)
|
||||||
|
@ -136,63 +137,36 @@ describe('User CRUD tests', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// it('should receive confirmation email after verifying a User Account', function(done) {
|
it(' > should be able to login and logout a verified User Account', function(done) {
|
||||||
// mailbox.getEmails(function(err, _emails) {
|
userSession.post('/auth/signin')
|
||||||
// if(err) throw err;
|
.send(credentials)
|
||||||
// var email = _emails[0];
|
.expect('Content-Type', /json/)
|
||||||
|
.expect(200)
|
||||||
|
.end(function(signinErr, signinRes) {
|
||||||
|
// Handle signin error
|
||||||
|
if (signinErr) done(signinErr);
|
||||||
|
|
||||||
// // console.log('mailbox.getEmails:');
|
var user = signinRes.body;
|
||||||
// console.log(email);
|
(user.username).should.equal(credentials.username);
|
||||||
// (email.subject).should.equal('Account successfully verified!');
|
|
||||||
// done();
|
userSession.get('/auth/signout')
|
||||||
// });
|
.expect(200)
|
||||||
// });
|
.end(function(signoutErr, signoutRes) {
|
||||||
|
|
||||||
|
// Handle signout error
|
||||||
|
if (signoutErr) done(signoutErr);
|
||||||
|
|
||||||
|
(signoutRes.text).should.equal('Successfully logged out');
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to login and logout a User', function (done) {
|
it(' > should be able to reset a User\'s password');
|
||||||
var username = 'testActiveAccount.be1e58fb@mailosaur.in';
|
|
||||||
// _User.email = _User.username = credentials.username = username;
|
|
||||||
// Create a new user
|
|
||||||
var newUser = {
|
|
||||||
firstName: 'Full',
|
|
||||||
lastName: 'Name',
|
|
||||||
email: credentials.username,
|
|
||||||
username: credentials.username,
|
|
||||||
password: credentials.password,
|
|
||||||
};
|
|
||||||
userSession.post('/auth/signup')
|
|
||||||
.send(newUser)
|
|
||||||
.expect(200)
|
|
||||||
.end(function(FormSaveErr, FormSaveRes) {
|
|
||||||
(FormSaveRes.text).should.equal('An email has been sent to you. Please check it to verify your account.');
|
|
||||||
|
|
||||||
userSession.post('/auth/signin')
|
it(' > should be able to delete a User account without any problems');
|
||||||
.send(credentials)
|
|
||||||
.expect('Content-Type', /json/)
|
|
||||||
.expect(200)
|
|
||||||
.end(function(signinErr, signinRes) {
|
|
||||||
|
|
||||||
// Handle signin error
|
|
||||||
if (signinErr) throw signinErr;
|
|
||||||
|
|
||||||
userSession.get('/auth/signout')
|
|
||||||
.expect(200)
|
|
||||||
.end(function(signoutErr, signoutRes) {
|
|
||||||
|
|
||||||
// Handle signout error
|
|
||||||
if (signoutErr) throw signoutErr;
|
|
||||||
|
|
||||||
(signoutRes.text).should.equal('Successfully logged out');
|
|
||||||
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be able to reset a User\'s password');
|
|
||||||
|
|
||||||
it('should be able to delete a User account without any problems');
|
|
||||||
|
|
||||||
afterEach(function(done) {
|
afterEach(function(done) {
|
||||||
User.remove().exec(function () {
|
User.remove().exec(function () {
|
||||||
|
|
|
@ -50,7 +50,7 @@ module.exports.getGlobbedFiles = function(globPatterns, removeRoot) {
|
||||||
if (urlRegex.test(globPatterns)) {
|
if (urlRegex.test(globPatterns)) {
|
||||||
output.push(globPatterns);
|
output.push(globPatterns);
|
||||||
} else {
|
} else {
|
||||||
var files = glob.sync(globPatterns)
|
var files = glob.sync(globPatterns);
|
||||||
if (removeRoot) {
|
if (removeRoot) {
|
||||||
files = files.map(function(file) {
|
files = files.map(function(file) {
|
||||||
return file.replace(removeRoot, '');
|
return file.replace(removeRoot, '');
|
||||||
|
|
|
@ -37,6 +37,11 @@ module.exports = function(db) {
|
||||||
require(path.resolve(modelPath));
|
require(path.resolve(modelPath));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Globbing routing files
|
||||||
|
config.getGlobbedFiles('./app/routes/**/*.js').forEach(function(routePath) {
|
||||||
|
require(path.resolve(routePath))(app);
|
||||||
|
});
|
||||||
|
|
||||||
// Setting application local variables
|
// Setting application local variables
|
||||||
app.locals.title = config.app.title;
|
app.locals.title = config.app.title;
|
||||||
app.locals.description = config.app.description;
|
app.locals.description = config.app.description;
|
||||||
|
@ -135,11 +140,6 @@ module.exports = function(db) {
|
||||||
// connect flash for flash messages
|
// connect flash for flash messages
|
||||||
app.use(flash());
|
app.use(flash());
|
||||||
|
|
||||||
// Globbing routing files
|
|
||||||
config.getGlobbedFiles('./app/routes/**/*.js').forEach(function(routePath) {
|
|
||||||
require(path.resolve(routePath))(app);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add headers for Sentry
|
// Add headers for Sentry
|
||||||
app.use(function (req, res, next) {
|
app.use(function (req, res, next) {
|
||||||
|
|
||||||
|
|
|
@ -1,41 +1,41 @@
|
||||||
'use strict';
|
// 'use strict';
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Module dependencies.
|
// * Module dependencies.
|
||||||
*/
|
// */
|
||||||
var passport = require('passport'),
|
// var passport = require('passport'),
|
||||||
FacebookStrategy = require('passport-facebook').Strategy,
|
// FacebookStrategy = require('passport-facebook').Strategy,
|
||||||
config = require('../config'),
|
// config = require('../config'),
|
||||||
users = require('../../app/controllers/users.server.controller');
|
// users = require('../../app/controllers/users.server.controller');
|
||||||
|
|
||||||
module.exports = function() {
|
// module.exports = function() {
|
||||||
// Use facebook strategy
|
// // Use facebook strategy
|
||||||
passport.use(new FacebookStrategy({
|
// passport.use(new FacebookStrategy({
|
||||||
clientID: config.facebook.clientID,
|
// clientID: config.facebook.clientID,
|
||||||
clientSecret: config.facebook.clientSecret,
|
// clientSecret: config.facebook.clientSecret,
|
||||||
callbackURL: config.facebook.callbackURL,
|
// callbackURL: config.facebook.callbackURL,
|
||||||
passReqToCallback: true
|
// passReqToCallback: true
|
||||||
},
|
// },
|
||||||
function(req, accessToken, refreshToken, profile, done) {
|
// function(req, accessToken, refreshToken, profile, done) {
|
||||||
// Set the provider data and include tokens
|
// // Set the provider data and include tokens
|
||||||
var providerData = profile._json;
|
// var providerData = profile._json;
|
||||||
providerData.accessToken = accessToken;
|
// providerData.accessToken = accessToken;
|
||||||
providerData.refreshToken = refreshToken;
|
// providerData.refreshToken = refreshToken;
|
||||||
|
|
||||||
// Create the user OAuth profile
|
// // Create the user OAuth profile
|
||||||
var providerUserProfile = {
|
// var providerUserProfile = {
|
||||||
firstName: profile.name.givenName,
|
// firstName: profile.name.givenName,
|
||||||
lastName: profile.name.familyName,
|
// lastName: profile.name.familyName,
|
||||||
displayName: profile.displayName,
|
// displayName: profile.displayName,
|
||||||
email: profile.emails[0].value,
|
// email: profile.emails[0].value,
|
||||||
username: profile.username,
|
// username: profile.username,
|
||||||
provider: 'facebook',
|
// provider: 'facebook',
|
||||||
providerIdentifierField: 'id',
|
// providerIdentifierField: 'id',
|
||||||
providerData: providerData
|
// providerData: providerData
|
||||||
};
|
// };
|
||||||
|
|
||||||
// Save the user OAuth profile
|
// // Save the user OAuth profile
|
||||||
users.saveOAuthUserProfile(req, providerUserProfile, done);
|
// users.saveOAuthUserProfile(req, providerUserProfile, done);
|
||||||
}
|
// }
|
||||||
));
|
// ));
|
||||||
};
|
// };
|
||||||
|
|
|
@ -1,46 +1,46 @@
|
||||||
'use strict';
|
// 'use strict';
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Module dependencies.
|
// * Module dependencies.
|
||||||
*/
|
// */
|
||||||
var passport = require('passport'),
|
// var passport = require('passport'),
|
||||||
GithubStrategy = require('passport-github').Strategy,
|
// GithubStrategy = require('passport-github').Strategy,
|
||||||
config = require('../config'),
|
// config = require('../config'),
|
||||||
users = require('../../app/controllers/users.server.controller');
|
// users = require('../../app/controllers/users.server.controller');
|
||||||
|
|
||||||
module.exports = function() {
|
// module.exports = function() {
|
||||||
// Use github strategy
|
// // Use github strategy
|
||||||
passport.use(new GithubStrategy({
|
// passport.use(new GithubStrategy({
|
||||||
clientID: config.github.clientID,
|
// clientID: config.github.clientID,
|
||||||
clientSecret: config.github.clientSecret,
|
// clientSecret: config.github.clientSecret,
|
||||||
callbackURL: config.github.callbackURL,
|
// callbackURL: config.github.callbackURL,
|
||||||
passReqToCallback: true
|
// passReqToCallback: true
|
||||||
},
|
// },
|
||||||
function(req, accessToken, refreshToken, profile, done) {
|
// function(req, accessToken, refreshToken, profile, done) {
|
||||||
// Set the provider data and include tokens
|
// // Set the provider data and include tokens
|
||||||
var providerData = profile._json;
|
// var providerData = profile._json;
|
||||||
providerData.accessToken = accessToken;
|
// providerData.accessToken = accessToken;
|
||||||
providerData.refreshToken = refreshToken;
|
// providerData.refreshToken = refreshToken;
|
||||||
|
|
||||||
// Create the user OAuth profile
|
// // Create the user OAuth profile
|
||||||
var displayName = profile.displayName.trim();
|
// var displayName = profile.displayName.trim();
|
||||||
var iSpace = displayName.indexOf(' '); // index of the whitespace following the firstName
|
// var iSpace = displayName.indexOf(' '); // index of the whitespace following the firstName
|
||||||
var firstName = iSpace !== -1 ? displayName.substring(0, iSpace) : displayName;
|
// var firstName = iSpace !== -1 ? displayName.substring(0, iSpace) : displayName;
|
||||||
var lastName = iSpace !== -1 ? displayName.substring(iSpace + 1) : '';
|
// var lastName = iSpace !== -1 ? displayName.substring(iSpace + 1) : '';
|
||||||
|
|
||||||
var providerUserProfile = {
|
// var providerUserProfile = {
|
||||||
firstName: firstName,
|
// firstName: firstName,
|
||||||
lastName: lastName,
|
// lastName: lastName,
|
||||||
displayName: displayName,
|
// displayName: displayName,
|
||||||
email: profile.emails[0].value,
|
// email: profile.emails[0].value,
|
||||||
username: profile.username,
|
// username: profile.username,
|
||||||
provider: 'github',
|
// provider: 'github',
|
||||||
providerIdentifierField: 'id',
|
// providerIdentifierField: 'id',
|
||||||
providerData: providerData
|
// providerData: providerData
|
||||||
};
|
// };
|
||||||
|
|
||||||
// Save the user OAuth profile
|
// // Save the user OAuth profile
|
||||||
users.saveOAuthUserProfile(req, providerUserProfile, done);
|
// users.saveOAuthUserProfile(req, providerUserProfile, done);
|
||||||
}
|
// }
|
||||||
));
|
// ));
|
||||||
};
|
// };
|
||||||
|
|
|
@ -1,41 +1,41 @@
|
||||||
'use strict';
|
// 'use strict';
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Module dependencies.
|
// * Module dependencies.
|
||||||
*/
|
// */
|
||||||
var passport = require('passport'),
|
// var passport = require('passport'),
|
||||||
GoogleStrategy = require('passport-google-oauth').OAuth2Strategy,
|
// GoogleStrategy = require('passport-google-oauth').OAuth2Strategy,
|
||||||
config = require('../config'),
|
// config = require('../config'),
|
||||||
users = require('../../app/controllers/users.server.controller');
|
// users = require('../../app/controllers/users.server.controller');
|
||||||
|
|
||||||
module.exports = function() {
|
// module.exports = function() {
|
||||||
// Use google strategy
|
// // Use google strategy
|
||||||
passport.use(new GoogleStrategy({
|
// passport.use(new GoogleStrategy({
|
||||||
clientID: config.google.clientID,
|
// clientID: config.google.clientID,
|
||||||
clientSecret: config.google.clientSecret,
|
// clientSecret: config.google.clientSecret,
|
||||||
callbackURL: config.google.callbackURL,
|
// callbackURL: config.google.callbackURL,
|
||||||
passReqToCallback: true
|
// passReqToCallback: true
|
||||||
},
|
// },
|
||||||
function(req, accessToken, refreshToken, profile, done) {
|
// function(req, accessToken, refreshToken, profile, done) {
|
||||||
// Set the provider data and include tokens
|
// // Set the provider data and include tokens
|
||||||
var providerData = profile._json;
|
// var providerData = profile._json;
|
||||||
providerData.accessToken = accessToken;
|
// providerData.accessToken = accessToken;
|
||||||
providerData.refreshToken = refreshToken;
|
// providerData.refreshToken = refreshToken;
|
||||||
|
|
||||||
// Create the user OAuth profile
|
// // Create the user OAuth profile
|
||||||
var providerUserProfile = {
|
// var providerUserProfile = {
|
||||||
firstName: profile.name.givenName,
|
// firstName: profile.name.givenName,
|
||||||
lastName: profile.name.familyName,
|
// lastName: profile.name.familyName,
|
||||||
displayName: profile.displayName,
|
// displayName: profile.displayName,
|
||||||
email: profile.emails[0].value,
|
// email: profile.emails[0].value,
|
||||||
username: profile.username,
|
// username: profile.username,
|
||||||
provider: 'google',
|
// provider: 'google',
|
||||||
providerIdentifierField: 'id',
|
// providerIdentifierField: 'id',
|
||||||
providerData: providerData
|
// providerData: providerData
|
||||||
};
|
// };
|
||||||
|
|
||||||
// Save the user OAuth profile
|
// // Save the user OAuth profile
|
||||||
users.saveOAuthUserProfile(req, providerUserProfile, done);
|
// users.saveOAuthUserProfile(req, providerUserProfile, done);
|
||||||
}
|
// }
|
||||||
));
|
// ));
|
||||||
};
|
// };
|
||||||
|
|
|
@ -1,42 +1,42 @@
|
||||||
'use strict';
|
// 'use strict';
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Module dependencies.
|
// * Module dependencies.
|
||||||
*/
|
// */
|
||||||
var passport = require('passport'),
|
// var passport = require('passport'),
|
||||||
LinkedInStrategy = require('passport-linkedin').Strategy,
|
// LinkedInStrategy = require('passport-linkedin').Strategy,
|
||||||
config = require('../config'),
|
// config = require('../config'),
|
||||||
users = require('../../app/controllers/users.server.controller');
|
// users = require('../../app/controllers/users.server.controller');
|
||||||
|
|
||||||
module.exports = function() {
|
// module.exports = function() {
|
||||||
// Use linkedin strategy
|
// // Use linkedin strategy
|
||||||
passport.use(new LinkedInStrategy({
|
// passport.use(new LinkedInStrategy({
|
||||||
consumerKey: config.linkedin.clientID,
|
// consumerKey: config.linkedin.clientID,
|
||||||
consumerSecret: config.linkedin.clientSecret,
|
// consumerSecret: config.linkedin.clientSecret,
|
||||||
callbackURL: config.linkedin.callbackURL,
|
// callbackURL: config.linkedin.callbackURL,
|
||||||
passReqToCallback: true,
|
// passReqToCallback: true,
|
||||||
profileFields: ['id', 'first-name', 'last-name', 'email-address']
|
// profileFields: ['id', 'first-name', 'last-name', 'email-address']
|
||||||
},
|
// },
|
||||||
function(req, accessToken, refreshToken, profile, done) {
|
// function(req, accessToken, refreshToken, profile, done) {
|
||||||
// Set the provider data and include tokens
|
// // Set the provider data and include tokens
|
||||||
var providerData = profile._json;
|
// var providerData = profile._json;
|
||||||
providerData.accessToken = accessToken;
|
// providerData.accessToken = accessToken;
|
||||||
providerData.refreshToken = refreshToken;
|
// providerData.refreshToken = refreshToken;
|
||||||
|
|
||||||
// Create the user OAuth profile
|
// // Create the user OAuth profile
|
||||||
var providerUserProfile = {
|
// var providerUserProfile = {
|
||||||
firstName: profile.name.givenName,
|
// firstName: profile.name.givenName,
|
||||||
lastName: profile.name.familyName,
|
// lastName: profile.name.familyName,
|
||||||
displayName: profile.displayName,
|
// displayName: profile.displayName,
|
||||||
email: profile.emails[0].value,
|
// email: profile.emails[0].value,
|
||||||
username: profile.username,
|
// username: profile.username,
|
||||||
provider: 'linkedin',
|
// provider: 'linkedin',
|
||||||
providerIdentifierField: 'id',
|
// providerIdentifierField: 'id',
|
||||||
providerData: providerData
|
// providerData: providerData
|
||||||
};
|
// };
|
||||||
|
|
||||||
// Save the user OAuth profile
|
// // Save the user OAuth profile
|
||||||
users.saveOAuthUserProfile(req, providerUserProfile, done);
|
// users.saveOAuthUserProfile(req, providerUserProfile, done);
|
||||||
}
|
// }
|
||||||
));
|
// ));
|
||||||
};
|
// };
|
||||||
|
|
|
@ -1,45 +1,45 @@
|
||||||
'use strict';
|
// 'use strict';
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Module dependencies.
|
// * Module dependencies.
|
||||||
*/
|
// */
|
||||||
var passport = require('passport'),
|
// var passport = require('passport'),
|
||||||
TwitterStrategy = require('passport-twitter').Strategy,
|
// TwitterStrategy = require('passport-twitter').Strategy,
|
||||||
config = require('../config'),
|
// config = require('../config'),
|
||||||
users = require('../../app/controllers/users.server.controller');
|
// users = require('../../app/controllers/users.server.controller');
|
||||||
|
|
||||||
module.exports = function() {
|
// module.exports = function() {
|
||||||
// Use twitter strategy
|
// // Use twitter strategy
|
||||||
passport.use(new TwitterStrategy({
|
// passport.use(new TwitterStrategy({
|
||||||
consumerKey: config.twitter.clientID,
|
// consumerKey: config.twitter.clientID,
|
||||||
consumerSecret: config.twitter.clientSecret,
|
// consumerSecret: config.twitter.clientSecret,
|
||||||
callbackURL: config.twitter.callbackURL,
|
// callbackURL: config.twitter.callbackURL,
|
||||||
passReqToCallback: true
|
// passReqToCallback: true
|
||||||
},
|
// },
|
||||||
function(req, token, tokenSecret, profile, done) {
|
// function(req, token, tokenSecret, profile, done) {
|
||||||
// Set the provider data and include tokens
|
// // Set the provider data and include tokens
|
||||||
var providerData = profile._json;
|
// var providerData = profile._json;
|
||||||
providerData.token = token;
|
// providerData.token = token;
|
||||||
providerData.tokenSecret = tokenSecret;
|
// providerData.tokenSecret = tokenSecret;
|
||||||
|
|
||||||
// Create the user OAuth profile
|
// // Create the user OAuth profile
|
||||||
var displayName = profile.displayName.trim();
|
// var displayName = profile.displayName.trim();
|
||||||
var iSpace = displayName.indexOf(' '); // index of the whitespace following the firstName
|
// var iSpace = displayName.indexOf(' '); // index of the whitespace following the firstName
|
||||||
var firstName = iSpace !== -1 ? displayName.substring(0, iSpace) : displayName;
|
// var firstName = iSpace !== -1 ? displayName.substring(0, iSpace) : displayName;
|
||||||
var lastName = iSpace !== -1 ? displayName.substring(iSpace + 1) : '';
|
// var lastName = iSpace !== -1 ? displayName.substring(iSpace + 1) : '';
|
||||||
|
|
||||||
var providerUserProfile = {
|
// var providerUserProfile = {
|
||||||
firstName: firstName,
|
// firstName: firstName,
|
||||||
lastName: lastName,
|
// lastName: lastName,
|
||||||
displayName: displayName,
|
// displayName: displayName,
|
||||||
username: profile.username,
|
// username: profile.username,
|
||||||
provider: 'twitter',
|
// provider: 'twitter',
|
||||||
providerIdentifierField: 'id_str',
|
// providerIdentifierField: 'id_str',
|
||||||
providerData: providerData
|
// providerData: providerData
|
||||||
};
|
// };
|
||||||
|
|
||||||
// Save the user OAuth profile
|
// // Save the user OAuth profile
|
||||||
users.saveOAuthUserProfile(req, providerUserProfile, done);
|
// users.saveOAuthUserProfile(req, providerUserProfile, done);
|
||||||
}
|
// }
|
||||||
));
|
// ));
|
||||||
};
|
// };
|
||||||
|
|
15
gruntfile.js
15
gruntfile.js
|
@ -67,6 +67,12 @@ module.exports = function(grunt) {
|
||||||
options: {
|
options: {
|
||||||
jshintrc: true
|
jshintrc: true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
allTests: {
|
||||||
|
src: watchFiles.allTests,
|
||||||
|
options: {
|
||||||
|
jshintrc: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
csslint: {
|
csslint: {
|
||||||
|
@ -283,13 +289,14 @@ module.exports = function(grunt) {
|
||||||
grunt.registerTask('secure', ['env:secure', 'lint', 'html2js:main', 'concurrent:default']);
|
grunt.registerTask('secure', ['env:secure', 'lint', 'html2js:main', 'concurrent:default']);
|
||||||
|
|
||||||
// Lint task(s).
|
// Lint task(s).
|
||||||
grunt.registerTask('lint', ['newer:jshint', 'newer:csslint']);
|
grunt.registerTask('lint', ['jshint', 'csslint']);
|
||||||
|
grunt.registerTask('lint:tests', ['jshint:allTests']);
|
||||||
|
|
||||||
// Build task(s).
|
// Build task(s).
|
||||||
grunt.registerTask('build', ['lint', 'loadConfig', 'uglify', 'cssmin', 'ngAnnotate', 'html2js:main']);
|
grunt.registerTask('build', ['lint', 'loadConfig', 'uglify', 'cssmin', 'ngAnnotate', 'html2js:main']);
|
||||||
|
|
||||||
// Test task.
|
// Test task.
|
||||||
grunt.registerTask('test', ['test:server', 'test:client']);
|
grunt.registerTask('test', ['lint:tests', 'test:server', 'test:client']);
|
||||||
grunt.registerTask('test:server', ['html2js:main', 'env:test', 'mochaTest']);
|
grunt.registerTask('test:server', ['lint:tests', 'html2js:main', 'env:test', 'mochaTest']);
|
||||||
grunt.registerTask('test:client', ['html2js:main', 'env:test', 'karma:unit']);
|
grunt.registerTask('test:client', ['lint:tests', 'html2js:main', 'env:test', 'karma:unit']);
|
||||||
};
|
};
|
||||||
|
|
|
@ -88,6 +88,7 @@
|
||||||
"useragent": "~2.1.7"
|
"useragent": "~2.1.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"coveralls": "^2.11.4",
|
||||||
"grunt-mocha-istanbul": "^3.0.1",
|
"grunt-mocha-istanbul": "^3.0.1",
|
||||||
"grunt-mocha-test": "~0.12.1",
|
"grunt-mocha-test": "~0.12.1",
|
||||||
"istanbul": "^0.4.0",
|
"istanbul": "^0.4.0",
|
||||||
|
@ -102,6 +103,7 @@
|
||||||
"karma-phantomjs-launcher": "~0.1.2",
|
"karma-phantomjs-launcher": "~0.1.2",
|
||||||
"mailosaur": "^1.0.1",
|
"mailosaur": "^1.0.1",
|
||||||
"mocha": ">=1.20.0",
|
"mocha": ">=1.20.0",
|
||||||
|
"mocha-lcov-reporter": "^1.0.0",
|
||||||
"node-mandrill": "^1.0.1",
|
"node-mandrill": "^1.0.1",
|
||||||
"should": "~7.1.1",
|
"should": "~7.1.1",
|
||||||
"supertest": "~1.1.0",
|
"supertest": "~1.1.0",
|
||||||
|
|
|
@ -49,7 +49,7 @@ angular.module('forms').directive('configureFormDirective', ['$rootScope', '$htt
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.uploadPDF = function(files) {
|
$scope.uploadPDF = function(files) {
|
||||||
console.log(files)
|
// console.log(files);
|
||||||
|
|
||||||
if (files && files.length) {
|
if (files && files.length) {
|
||||||
var file = files[0];
|
var file = files[0];
|
||||||
|
|
|
@ -102,7 +102,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
||||||
$scope.deleteField = function (field_index){
|
$scope.deleteField = function (field_index){
|
||||||
|
|
||||||
//Delete field from field map
|
//Delete field from field map
|
||||||
var currFieldId = $scope.myform.form_fields[field_index]._id
|
var currFieldId = $scope.myform.form_fields[field_index]._id;
|
||||||
if($scope.myform.hasOwnProperty('plugins.oscarhost.baseUrl')) delete $scope.myform.plugins.oscarhost.settings.fieldMap[currFieldId];
|
if($scope.myform.hasOwnProperty('plugins.oscarhost.baseUrl')) delete $scope.myform.plugins.oscarhost.settings.fieldMap[currFieldId];
|
||||||
|
|
||||||
//Delete field
|
//Delete field
|
||||||
|
|
|
@ -25,7 +25,7 @@ angular.module('forms').service('TimeCounter', [
|
||||||
|
|
||||||
this.clockStarted = function(){
|
this.clockStarted = function(){
|
||||||
return !!this._startTime;
|
return !!this._startTime;
|
||||||
}
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
|
@ -1,3 +1,4 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
// Forms Controller Spec
|
// Forms Controller Spec
|
||||||
|
@ -17,13 +18,13 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var pdfObj = {
|
var pdfObj = {
|
||||||
fieldname:"file",
|
fieldname:'file',
|
||||||
originalname:"test.pdf",
|
originalname:'test.pdf',
|
||||||
name:"1440112660375.pdf",
|
name:'1440112660375.pdf',
|
||||||
encoding:"7bit",
|
encoding:'7bit',
|
||||||
mimetype:"application/pdf",
|
mimetype:'application/pdf',
|
||||||
path:"uploads/tmp/test@test.com/1440112660375.pdf",
|
path:'uploads/tmp/test@test.com/1440112660375.pdf',
|
||||||
extension:"pdf",
|
extension:'pdf',
|
||||||
size:56223,
|
size:56223,
|
||||||
truncated:false,
|
truncated:false,
|
||||||
buffer:null
|
buffer:null
|
||||||
|
@ -81,7 +82,7 @@
|
||||||
tmp_scope.user = sampleUser;
|
tmp_scope.user = sampleUser;
|
||||||
|
|
||||||
//gotacha: Controller and link functions will execute.
|
//gotacha: Controller and link functions will execute.
|
||||||
el = angular.element('<configure-form-directive myform="myform" user="user"></configure-form-directive>');
|
el = angular.element('<configure-form-directive myform='myform' user='user'></configure-form-directive>');
|
||||||
$compile(el)(tmp_scope);
|
$compile(el)(tmp_scope);
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
|
|
|
@ -18,13 +18,13 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var pdfObj = {
|
var pdfObj = {
|
||||||
fieldname:"file",
|
fieldname:'file',
|
||||||
originalname:"test.pdf",
|
originalname:'test.pdf',
|
||||||
name:"1440112660375.pdf",
|
name:'1440112660375.pdf',
|
||||||
encoding:"7bit",
|
encoding:'7bit',
|
||||||
mimetype:"application/pdf",
|
mimetype:'application/pdf',
|
||||||
path:"uploads/tmp/test@test.com/1440112660375.pdf",
|
path:'uploads/tmp/test@test.com/1440112660375.pdf',
|
||||||
extension:"pdf",
|
extension:'pdf',
|
||||||
size:56223,
|
size:56223,
|
||||||
truncated:false,
|
truncated:false,
|
||||||
buffer:null
|
buffer:null
|
||||||
|
@ -131,7 +131,7 @@
|
||||||
tmp_scope.user = sampleUser;
|
tmp_scope.user = sampleUser;
|
||||||
|
|
||||||
//gotacha: Controller and link functions will execute.
|
//gotacha: Controller and link functions will execute.
|
||||||
el = angular.element('<edit-submissions-form-directive myform="myform" user="user"></edit-submissions-form-directive>');
|
el = angular.element('<edit-submissions-form-directive myform='myform' user='user'></edit-submissions-form-directive>');
|
||||||
$compile(el)(tmp_scope);
|
$compile(el)(tmp_scope);
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
|
|
|
@ -18,13 +18,13 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var pdfObj = {
|
var pdfObj = {
|
||||||
fieldname:"file",
|
fieldname:'file',
|
||||||
originalname:"test.pdf",
|
originalname:'test.pdf',
|
||||||
name:"1440112660375.pdf",
|
name:'1440112660375.pdf',
|
||||||
encoding:"7bit",
|
encoding:'7bit',
|
||||||
mimetype:"application/pdf",
|
mimetype:'application/pdf',
|
||||||
path:"uploads/tmp/test@test.com/1440112660375.pdf",
|
path:'uploads/tmp/test@test.com/1440112660375.pdf',
|
||||||
extension:"pdf",
|
extension:'pdf',
|
||||||
size:56223,
|
size:56223,
|
||||||
truncated:false,
|
truncated:false,
|
||||||
buffer:null
|
buffer:null
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
tmp_scope.myform = _.cloneDeep(sampleForm);
|
tmp_scope.myform = _.cloneDeep(sampleForm);
|
||||||
|
|
||||||
//gotacha: Controller and link functions will execute.
|
//gotacha: Controller and link functions will execute.
|
||||||
el = angular.element('<edit-form-directive myform="myform"></edit-form-directive>');
|
el = angular.element('<edit-form-directive myform='myform'></edit-form-directive>');
|
||||||
$compile(el)(tmp_scope);
|
$compile(el)(tmp_scope);
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
angular.module('stateMock',[]);
|
angular.module('stateMock',[]);
|
||||||
angular.module('stateMock').service("$state", function($q){
|
angular.module('stateMock').service('$state', function($q){
|
||||||
this.expectedTransitions = [];
|
this.expectedTransitions = [];
|
||||||
this.transitionTo = function(stateName){
|
this.transitionTo = function(stateName){
|
||||||
if(this.expectedTransitions.length > 0){
|
if(this.expectedTransitions.length > 0){
|
||||||
var expectedState = this.expectedTransitions.shift();
|
var expectedState = this.expectedTransitions.shift();
|
||||||
if(expectedState !== stateName){
|
if(expectedState !== stateName){
|
||||||
throw Error("Expected transition to state: " + expectedState + " but transitioned to " + stateName );
|
throw Error('Expected transition to state: ' + expectedState + ' but transitioned to ' + stateName );
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
throw Error("No more transitions were expected! Tried to transition to "+ stateName );
|
throw Error('No more transitions were expected! Tried to transition to '+ stateName );
|
||||||
}
|
}
|
||||||
console.log("Mock transition to: " + stateName);
|
console.log('Mock transition to: ' + stateName);
|
||||||
var deferred = $q.defer();
|
var deferred = $q.defer();
|
||||||
var promise = deferred.promise;
|
var promise = deferred.promise;
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
return promise;
|
return promise;
|
||||||
}
|
};
|
||||||
|
|
||||||
this.go = this.transitionTo;
|
this.go = this.transitionTo;
|
||||||
this.expectTransitionTo = function(stateName){
|
this.expectTransitionTo = function(stateName){
|
||||||
this.expectedTransitions.push(stateName);
|
this.expectedTransitions.push(stateName);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
this.ensureAllTransitionsHappened = function(){
|
this.ensureAllTransitionsHappened = function(){
|
||||||
if(this.expectedTransitions.length > 0){
|
if(this.expectedTransitions.length > 0){
|
||||||
throw Error("Not all transitions happened!");
|
throw Error('Not all transitions happened!');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
});
|
});
|
|
@ -7,9 +7,6 @@ var init = require('./config/init')(),
|
||||||
mongoose = require('mongoose'),
|
mongoose = require('mongoose'),
|
||||||
chalk = require('chalk');
|
chalk = require('chalk');
|
||||||
|
|
||||||
require('events').EventEmitter.prototype._maxListeners = 100;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main application entry file.
|
* Main application entry file.
|
||||||
* Please note that the order of loading is important.
|
* Please note that the order of loading is important.
|
||||||
|
|
Loading…
Reference in a new issue