diff --git a/config/assets/cloud-foundry.js b/config/assets/cloud-foundry.js index 1e7744763b..ed4f296173 100644 --- a/config/assets/cloud-foundry.js +++ b/config/assets/cloud-foundry.js @@ -1,23 +1,23 @@ 'use strict'; module.exports = { - client: { - lib: { - css: [ - 'public/lib/bootstrap/dist/css/bootstrap.min.css', - 'public/lib/bootstrap/dist/css/bootstrap-theme.min.css', - ], - js: [ - 'public/lib/angular/angular.min.js', - 'public/lib/angular-resource/angular-resource.min.js', - 'public/lib/angular-animate/angular-animate.min.js', - 'public/lib/angular-ui-router/release/angular-ui-router.min.js', - 'public/lib/angular-ui-utils/ui-utils.min.js', - 'public/lib/angular-bootstrap/ui-bootstrap-tpls.min.js', - 'public/lib/angular-file-upload/angular-file-upload.min.js' - ] - }, - css: 'public/dist/application.min.css', - js: 'public/dist/application.min.js' - } -}; \ No newline at end of file + client: { + lib: { + css: [ + 'public/lib/bootstrap/dist/css/bootstrap.min.css', + 'public/lib/bootstrap/dist/css/bootstrap-theme.min.css', + ], + js: [ + 'public/lib/angular/angular.min.js', + 'public/lib/angular-resource/angular-resource.min.js', + 'public/lib/angular-animate/angular-animate.min.js', + 'public/lib/angular-ui-router/release/angular-ui-router.min.js', + 'public/lib/angular-ui-utils/ui-utils.min.js', + 'public/lib/angular-bootstrap/ui-bootstrap-tpls.min.js', + 'public/lib/angular-file-upload/angular-file-upload.min.js' + ] + }, + css: 'public/dist/application.min.css', + js: 'public/dist/application.min.js' + } +}; diff --git a/config/env/cloud-foundry.js b/config/env/cloud-foundry.js index 361bb94514..8ee7e63225 100644 --- a/config/env/cloud-foundry.js +++ b/config/env/cloud-foundry.js @@ -1,71 +1,70 @@ 'use strict'; var cfenv = require('cfenv'), - appEnv = cfenv.getAppEnv(), - cfMongoUrl = appEnv.getService('mean-mongo') ? - appEnv.getService('mean-mongo').credentials.uri : undefined; + appEnv = cfenv.getAppEnv(), + cfMongoUrl = appEnv.getService('mean-mongo') ? + appEnv.getService('mean-mongo').credentials.uri : undefined; -var getCred = function(serviceName, credProp) { - return appEnv.getService(serviceName) ? - appEnv.getService(serviceName).credentials[credProp] : undefined; +var getCred = function (serviceName, credProp) { + return appEnv.getService(serviceName) ? + appEnv.getService(serviceName).credentials[credProp] : undefined; }; module.exports = { - port: appEnv.port, - db: { - uri: cfMongoUrl, - options: { - user: '', - pass: '' - } - }, - log: { - // Can specify one of 'combined', 'common', 'dev', 'short', 'tiny' - format: 'combined', - // Stream defaults to process.stdout - // By default we want logs to go to process.out so the Cloud Foundry Loggregator will collect them - options: { - } - }, - facebook: { - clientID: getCred('mean-facebook', 'id') || 'APP_ID', - clientSecret: getCred('mean-facebook', 'secret') || 'APP_SECRET', - callbackURL: '/api/auth/facebook/callback' - }, - twitter: { - clientID: getCred('mean-twitter', 'key') || 'CONSUMER_KEY', - clientSecret: getCred('mean-twitter', 'secret') || 'CONSUMER_SECRET', - callbackURL: '/api/auth/twitter/callback' - }, - google: { - clientID: getCred('mean-google', 'id') || 'APP_ID', - clientSecret: getCred('mean-google', 'secret') || 'APP_SECRET', - callbackURL: '/api/auth/google/callback' - }, - linkedin: { - clientID: getCred('mean-linkedin', 'id') || 'APP_ID', - clientSecret: getCred('mean-linkedin', 'secret') || 'APP_SECRET', - callbackURL: '/api/auth/linkedin/callback' - }, - github: { - clientID: getCred('mean-github', 'id') || 'APP_ID', - clientSecret: getCred('mean-github', 'secret') || 'APP_SECRET', - callbackURL: '/api/auth/github/callback' - }, - paypal: { - clientID: getCred('mean-paypal', 'id') || 'CLIENT_ID', - clientSecret: getCred('mean-paypal', 'secret') || 'CLIENT_SECRET', - callbackURL: '/api/auth/paypal/callback', - sandbox: false - }, - mailer: { - from: getCred('mean-mail', 'from') || 'MAILER_FROM', - options: { - service: getCred('mean-mail', 'service') || 'MAILER_SERVICE_PROVIDER', - auth: { - user: getCred('mean-mail', 'username') || 'MAILER_EMAIL_ID', - pass: getCred('mean-mail', 'password') || 'MAILER_PASSWORD' - } - } - } -}; \ No newline at end of file + port: appEnv.port, + db: { + uri: cfMongoUrl, + options: { + user: '', + pass: '' + } + }, + log: { + // Can specify one of 'combined', 'common', 'dev', 'short', 'tiny' + format: 'combined', + // Stream defaults to process.stdout + // By default we want logs to go to process.out so the Cloud Foundry Loggregator will collect them + options: {} + }, + facebook: { + clientID: getCred('mean-facebook', 'id') || 'APP_ID', + clientSecret: getCred('mean-facebook', 'secret') || 'APP_SECRET', + callbackURL: '/api/auth/facebook/callback' + }, + twitter: { + clientID: getCred('mean-twitter', 'key') || 'CONSUMER_KEY', + clientSecret: getCred('mean-twitter', 'secret') || 'CONSUMER_SECRET', + callbackURL: '/api/auth/twitter/callback' + }, + google: { + clientID: getCred('mean-google', 'id') || 'APP_ID', + clientSecret: getCred('mean-google', 'secret') || 'APP_SECRET', + callbackURL: '/api/auth/google/callback' + }, + linkedin: { + clientID: getCred('mean-linkedin', 'id') || 'APP_ID', + clientSecret: getCred('mean-linkedin', 'secret') || 'APP_SECRET', + callbackURL: '/api/auth/linkedin/callback' + }, + github: { + clientID: getCred('mean-github', 'id') || 'APP_ID', + clientSecret: getCred('mean-github', 'secret') || 'APP_SECRET', + callbackURL: '/api/auth/github/callback' + }, + paypal: { + clientID: getCred('mean-paypal', 'id') || 'CLIENT_ID', + clientSecret: getCred('mean-paypal', 'secret') || 'CLIENT_SECRET', + callbackURL: '/api/auth/paypal/callback', + sandbox: false + }, + mailer: { + from: getCred('mean-mail', 'from') || 'MAILER_FROM', + options: { + service: getCred('mean-mail', 'service') || 'MAILER_SERVICE_PROVIDER', + auth: { + user: getCred('mean-mail', 'username') || 'MAILER_EMAIL_ID', + pass: getCred('mean-mail', 'password') || 'MAILER_PASSWORD' + } + } + } +}; diff --git a/config/lib/app.js b/config/lib/app.js index fb32c2071b..1feede39ed 100644 --- a/config/lib/app.js +++ b/config/lib/app.js @@ -4,49 +4,48 @@ * Module dependencies. */ var config = require('../config'), - mongoose = require('./mongoose'), - express = require('./express'), - chalk = require('chalk'); + mongoose = require('./mongoose'), + express = require('./express'), + chalk = require('chalk'); // Initialize Models mongoose.loadModels(); module.exports.loadModels = function loadModels() { - mongoose.loadModels(); + mongoose.loadModels(); }; module.exports.init = function init(callback) { + mongoose.connect(function (db) { + // Initialize express + var app = express.init(db); + if (callback) callback(app, db, config); - mongoose.connect(function (db) { - // Initialize express - var app = express.init(db); - if (callback) callback(app, db, config); - - }); + }); }; module.exports.start = function start(callback) { - var _this = this; + var _this = this; - _this.init(function(app, db, config) { + _this.init(function (app, db, config) { - // Start the app by listening on - app.listen(config.port, function() { + // Start the app by listening on + app.listen(config.port, function () { - // Logging initialization - console.log('--'); - console.log(chalk.green(config.app.title)); - 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\t' + config.db.uri)); - if (process.env.NODE_ENV === 'secure') { - console.log(chalk.green('HTTPs:\t\t\t\ton')); - } - console.log('--'); + // Logging initialization + console.log('--'); + console.log(chalk.green(config.app.title)); + 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\t' + config.db.uri)); + if (process.env.NODE_ENV === 'secure') { + console.log(chalk.green('HTTPs:\t\t\t\ton')); + } + console.log('--'); - if (callback) callback(app, db, config); - }); + if (callback) callback(app, db, config); + }); - }); + }); }; diff --git a/config/lib/express.js b/config/lib/express.js index edd3e74459..d7f0729c46 100644 --- a/config/lib/express.js +++ b/config/lib/express.js @@ -142,9 +142,9 @@ module.exports.initHelmetHeaders = function (app) { app.use(helmet.nosniff()); app.use(helmet.ienoopen()); app.use(helmet.hsts({ - maxAge: SIX_MONTHS, - includeSubdomains: true, - force: true + maxAge: SIX_MONTHS, + includeSubdomains: true, + force: true })); app.disable('x-powered-by'); }; diff --git a/modules/users/server/controllers/users/users.authentication.server.controller.js b/modules/users/server/controllers/users/users.authentication.server.controller.js index 40d8746f12..4c29bd661b 100644 --- a/modules/users/server/controllers/users/users.authentication.server.controller.js +++ b/modules/users/server/controllers/users/users.authentication.server.controller.js @@ -11,8 +11,8 @@ var path = require('path'), // URLs for which user can't be redirected on signin var noReturnUrls = [ - '/authentication/signin', - '/authentication/signup' + '/authentication/signin', + '/authentication/signup' ]; /**