Merge branch 'stage'

This commit is contained in:
David Baldwynn 2017-03-30 12:02:01 -07:00
commit e9fb0052d4
No known key found for this signature in database
GPG key ID: 15D1C13202224A9B
17 changed files with 181 additions and 32 deletions

View file

@ -24,6 +24,5 @@
"description": "Which mail service/API you will be using (i.e. SparkPost, Mandrill, etc)",
"value": "Sparkpost"
}
}
}

View file

@ -71,7 +71,7 @@
<script type="text/javascript">
var signupDisabled = {{signupDisabled | safe}};
var socketPort = {{socketPort | safe}};
var socketUrl = {{socketUrl | safe}};
var socketUrl = "{{socketUrl | safe}}";
var subdomainsDisabled = {{subdomainsDisabled | safe}};
</script>

View file

@ -72,6 +72,7 @@
<script type="text/javascript">
var signupDisabled = {{signupDisabled | safe}};
var socketPort = {{socketPort | safe}};
var socketUrl = "{{socketUrl | safe}}";
var subdomainsDisabled = {{subdomainsDisabled | safe}};
</script>

View file

@ -46,8 +46,9 @@
},
"resolutions": {
"angular-bootstrap": "^0.14.0",
"angular": "1.4.12",
"angular-ui-select": "compiled"
"angular": "1.4.14",
"angular-ui-select": "compiled",
"jspdf": "~1.0.178"
},
"overrides": {
"BOWER-PACKAGE": {

1
config/env/all.js vendored
View file

@ -21,6 +21,7 @@ module.exports = {
},
port: process.env.PORT || 3000,
socketPort: process.env.SOCKET_PORT || 20523,
templateEngine: 'swig',

View file

@ -9,7 +9,6 @@ module.exports = {
pass: ''
}
},
socketPort: process.env.SOCKET_PORT || 20523,
log: {
// Can specify one of 'combined', 'common', 'dev', 'short', 'tiny'

View file

@ -1,7 +1,7 @@
'use strict';
module.exports = {
baseUrl: process.env.BASE_URL || 'tellform.com',
baseUrl: process.env.BASE_URL || process.env.HEROKU_APP_NAME + '.herokuapp.com' || 'tellform.com',
db: {
uri: process.env.MONGODB_URI || process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://' + (process.env.DB_1_PORT_27017_TCP_ADDR || 'localhost') + '/mean',
},
@ -52,12 +52,25 @@ module.exports = {
callbackURL: '/auth/github/callback'
},
mailer: {
<<<<<<< HEAD
from: process.env.MAILER_FROM || 'testing@' + process.env.SPARKPOST_SANDBOX_DOMAIN || 'no-reply@tellform.com',
options: {
service: process.env.MAILER_SERVICE_PROVIDER || '',
/*ssl: false,
host: 'smtp.sparkpostmail.com',
port: 587,
secure: false,*/
auth: {
user: process.env.SPARKPOST_SMTP_USERNAME || process.env.MAILER_EMAIL_ID || '',
pass: process.env.SPARKPOST_SMTP_PASSWORD || process.env.MAILER_PASSWORD || ''
=======
from: process.env.MAILER_FROM || 'testing@'+process.env.SPARKPOST_SANDBOX_DOMAIN || 'no-reply@tellform.com',
options: {
service: process.env.MAILER_SERVICE_PROVIDER || '',
auth: {
user: process.env.MAILER_EMAIL_ID || process.env.SPARKPOST_SMTP_USERNAME || '',
pass: process.env.MAILER_PASSWORD || process.env.SPARKPOST_SMTP_PASSWORD || ''
>>>>>>> c08daea2ccfe85231755dc239fa1aff0ee8f5029
}
}
}

View file

@ -23,6 +23,8 @@
"init": "node scripts/setup.js"
},
"dependencies": {
"multer": "^1.3.0",
"glob": "^7.0.3",
"async": "^1.4.2",
"async-boolean-expression-evaluator": "^1.1.1",
"bcrypt": "^0.8.7",
@ -97,7 +99,6 @@
"coveralls": "^2.11.4",
"cross-spawn": "^5.0.0",
"del": "^2.2.2",
"glob": "^7.0.3",
"grunt-execute": "^0.2.2",
"grunt-mocha-istanbul": "^3.0.1",
"grunt-mocha-test": "~0.12.1",

View file

@ -2229,8 +2229,8 @@ angular.module('core').config(['$translateProvider', function ($translateProvide
'use strict';
// Forms controller
angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm', '$http', '$uibModal', 'myForm', '$filter', '$sce',
function($rootScope, $scope, $stateParams, $state, Forms, CurrentForm, $http, $uibModal, myForm, $filter, $sce) {
angular.module('forms').controller('AdminFormController', ['$rootScope', '$window', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm', '$http', '$uibModal', 'myForm', '$filter', '$sce',
function($rootScope, $window, $scope, $stateParams, $state, Forms, CurrentForm, $http, $uibModal, myForm, $filter, $sce) {
$scope.trustSrc = function(src) {
return $sce.trustAsResourceUrl(src);
@ -2253,10 +2253,14 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope
$scope.formURL = "/#!/forms/" + $scope.myform._id;
if(window.location.host.split('.').length < 3){
$scope.actualFormURL = window.location.protocol + '//' + $scope.myform.admin.username + '.' + window.location.host + $scope.formURL;
if($window.subdomainsDisabled == true){
$scope.actualFormURL = window.location.protocol + '//' + window.location.host + '/view' + $scope.formURL;
} else {
$scope.actualFormURL = window.location.protocol + '//' + $scope.myform.admin.username + '.' + window.location.host.split('.').slice(1,3).join('.') + $scope.formURL;
if(window.location.host.split('.').length < 3){
$scope.actualFormURL = window.location.protocol + '//' + $scope.myform.admin.username + '.' + window.location.host + $scope.formURL;
} else {
$scope.actualFormURL = window.location.protocol + '//' + $scope.myform.admin.username + '.' + window.location.host.split('.').slice(1,3).join('.') + $scope.formURL;
}
}
var refreshFrame = $scope.refreshFrame = function(){
@ -3946,6 +3950,71 @@ angular.module('forms').factory('Forms', ['$resource', 'FORM_URL',
}
]);
(function () {
'use strict';
// Create the Socket.io wrapper service
angular
.module('forms')
.factory('Socket', Socket);
Socket.$inject = ['$timeout', '$window'];
function Socket($timeout, $window) {
var service = {
connect: connect,
emit: emit,
on: on,
removeListener: removeListener,
socket: null
};
var url = '';
if($window.socketPort && $window.socketUrl){
url = $window.socketUrl + ':' + $window.socketPort;
} else if ($window.socketUrl && !$window.socketUrl){
url = $window.socketUrl;
} else if ($window.socketPort){
url = window.location.protocol+'//'+window.location.hostname + ':' + $window.socketPort;
} else {
url = window.location.protocol+'//'+window.location.hostname;
}
connect(url);
return service;
// Connect to Socket.io server
function connect(url) {
service.socket = io(url, {'transports': ['websocket', 'polling']});
}
// Wrap the Socket.io 'emit' method
function emit(eventName, data) {
if (service.socket) {
service.socket.emit(eventName, data);
}
}
// Wrap the Socket.io 'on' method
function on(eventName, callback) {
if (service.socket) {
service.socket.on(eventName, function (data) {
$timeout(function () {
callback(data);
});
});
}
}
// Wrap the Socket.io 'removeListener' method
function removeListener(eventName) {
if (service.socket) {
service.socket.removeListener(eventName);
}
}
}
}());
'use strict';
angular.module('forms').service('TimeCounter', [

File diff suppressed because one or more lines are too long

View file

@ -3,8 +3,8 @@
// Init the application configuration module for AngularJS application
var ApplicationConfiguration = (function() {
// Init module configuration options
var applicationModuleName = 'TellFormForm';
var applicationModuleVendorDependencies = ['duScroll', 'ui.select', 'ngSanitize', 'vButton', 'ngResource', 'TellForm.form_templates', 'ui.router', 'ui.bootstrap', 'ui.utils', 'pascalprecht.translate'];
var applicationModuleName = 'TellForm-Form';
var applicationModuleVendorDependencies = ['duScroll', 'ui.select', 'ngSanitize', 'vButton', 'ngResource', 'TellForm-Form.form_templates', 'ui.router', 'ui.bootstrap', 'ui.utils', 'pascalprecht.translate'];
// Add a new vertical module
var registerModule = function(moduleName, dependencies) {
@ -61,7 +61,7 @@ angular.element(document).ready(function() {
angular.bootstrap(document, [ApplicationConfiguration.applicationModuleName]);
});
angular.module('TellForm.form_templates', []).run(['$templateCache', function($templateCache) {
angular.module('TellForm-Form.form_templates', []).run(['$templateCache', function($templateCache) {
"use strict";
$templateCache.put("form_modules/forms/base/views/submit-form.client.view.html",
"<section class=public-form ng-style=\"{ 'background-color': myform.design.colors.backgroundColor }\"><submit-form-directive myform=myform></submit-form-directive></section><script ng-if=myform.analytics.gaCode>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n" +
@ -574,7 +574,7 @@ angular.module('view-form').directive('fieldDirective', ['$http', '$compile', '$
'natural'
];
var templateUrl = 'modules/forms/base/views/directiveViews/field/';
var templateUrl = 'form_modules/forms/base/views/directiveViews/field/';
if (__indexOf.call(supportedFields, type) >= 0) {
templateUrl = templateUrl+type+'.html';
@ -798,7 +798,7 @@ function hashFnv32a(str, asString, seed) {
angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCounter', '$filter', '$rootScope', 'SendVisitorData',
function ($http, TimeCounter, $filter, $rootScope, SendVisitorData) {
return {
templateUrl: 'modules/forms/base/views/directiveViews/form/submit-form.client.view.html',
templateUrl: 'form_modules/forms/base/views/directiveViews/form/submit-form.client.view.html',
restrict: 'E',
scope: {
myform:'='
@ -1210,14 +1210,16 @@ angular.module('view-form').factory('Forms', ['$resource', 'VIEW_FORM_URL',
};
var url = '';
console.log("$window.socketPort: "+$window.socketPort);
console.log("$window.socketUrl: "+$window.socketUrl);
if($window.socketPort && $window.socketUrl){
url = $window.socketUrl + ':' + $window.socketPort;
url = window.location.protocol + '//' + $window.socketUrl + ':' + $window.socketPort;
} else if ($window.socketUrl && !$window.socketUrl){
url = $window.socketUrl;
url = window.location.protocol + '//' + $window.socketUrl;
} else if ($window.socketPort){
url = window.location.protocol+'//'+window.location.hostname + ':' + $window.socketPort;
url = window.location.protocol + '//' + window.location.hostname + ':' + $window.socketPort;
} else {
url = window.location.protocol+'//'+window.location.hostname;
url = window.location.protocol + '//' + window.location.hostname;
}
connect(url);

File diff suppressed because one or more lines are too long

View file

@ -18,14 +18,16 @@
};
var url = '';
console.log("$window.socketPort: "+$window.socketPort);
console.log("$window.socketUrl: "+$window.socketUrl);
if($window.socketPort && $window.socketUrl){
url = $window.socketUrl + ':' + $window.socketPort;
url = window.location.protocol + '//' + $window.socketUrl + ':' + $window.socketPort;
} else if ($window.socketUrl && !$window.socketUrl){
url = $window.socketUrl;
url = window.location.protocol + '//' + $window.socketUrl;
} else if ($window.socketPort){
url = window.location.protocol+'//'+window.location.hostname + ':' + $window.socketPort;
url = window.location.protocol + '//' + window.location.hostname + ':' + $window.socketPort;
} else {
url = window.location.protocol+'//'+window.location.hostname;
url = window.location.protocol + '//' + window.location.hostname;
}
connect(url);

View file

@ -26,7 +26,7 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$windo
$scope.formURL = "/#!/forms/" + $scope.myform._id;
if($window.subdomainsDisabled == true){
$scope.actualFormURL = window.location.protocol + '//' + window.location.host + $scope.formURL;
$scope.actualFormURL = window.location.protocol + '//' + window.location.host + '/view' + $scope.formURL;
} else {
if(window.location.host.split('.').length < 3){
$scope.actualFormURL = window.location.protocol + '//' + $scope.myform.admin.username + '.' + window.location.host + $scope.formURL;

50
scripts/create_admin.js Normal file
View file

@ -0,0 +1,50 @@
var init = require('../config/init')(),
config = require('../config/config'),
mongoose = require('mongoose'),
chalk = require('chalk'),
fs = require('fs-extra');
// Bootstrap db connection
var db = mongoose.connect(config.db.uri, config.db.options, function(err) {
if (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')();
var User = mongoose.model('User');
require('../app/models/user.server.model.js');
var email = process.env.ADMIN_EMAIL;
var username = process.env.ADMIN_USERNAME;
var password = process.env.ADMIN_PASSWORD;
user = new User({
firstName: 'Admin',
lastName: 'Account',
email: email,
username: username,
password: password,
provider: 'local',
roles: ['admin', 'user']
});
user.save(function (err) {
if (err) return console.error(chalk.red(err));
console.log(chalk.green('Successfully created user'));
delete email;
delete password;
delete username;
process.exit(1);
});

View file

@ -70,6 +70,11 @@ var nodemailer_providers = [
'Zoho'
];
var bool_options = [
"TRUE",
"FALSE"
]
var questions = [
{
type: 'confirm',
@ -97,6 +102,12 @@ var questions = [
message: 'Do you want to disable signups?',
default: false
},
{
type: 'list',
name: 'SUBDOMAINS_DISABLED',
message: 'Do you want to have subdomains? (i.e. are you using a custom domain)',
choices: bool_options
},
{
type: 'list',
name: 'MAILER_SERVICE_PROVIDER',