fixed form preview issues

This commit is contained in:
David Baldwynn 2017-04-10 17:36:24 -07:00
parent 18cde5213d
commit 3f20bcf712
No known key found for this signature in database
GPG key ID: 15D1C13202224A9B
8 changed files with 47 additions and 36 deletions

View file

@ -174,7 +174,7 @@ exports.uploadTemp = function(req, res) {
*/
exports.readForRender = function(req, res) {
var newForm = req.form.toJSON();
console.log(req.user);
if (!newForm.isLive && !req.user) {
return res.status(404).send({
message: 'Form Does Not Exist'

5
config/env/all.js vendored
View file

@ -28,6 +28,7 @@ module.exports = {
reCAPTCHA_Key: process.env.reCAPTCHA_KEY || '',
signupDisabled: (process.env.SIGNUP_DISABLED === "TRUE"),
disableClusterMode: (process.env.DISABLE_CLUSTER_MODE === "TRUE"),
baseUrl: '',
tempUserCollection: 'temporary_users',
@ -57,10 +58,10 @@ module.exports = {
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
maxAge: 24 * 60 * 60 * 1000, // 24 hours
// To set the cookie in a specific domain uncomment the following
// setting:
// domain: 'tellform.com'
//domain: process.env.COOKIE_SESSION_URL || process.env.BASE_URL || '.tellform.com'
},
/*

View file

@ -19,9 +19,7 @@ module.exports = {
// stream: 'access.log'
}
},
sessionCookie: {
//domain: process.env.BASE_URL || 'http://localhost:3000'
},
facebook: {
clientID: process.env.FACEBOOK_ID || 'APP_ID',
clientSecret: process.env.FACEBOOK_SECRET || 'APP_SECRET',

View file

@ -18,7 +18,9 @@ module.exports = {
}
},
sessionCookie: {
//domain: process.env.BASE_URL || 'tellform.com'
secure: false,
maxAge: 24 * 60 * 60 * 1000, // 24 hours
domain: process.env.BASE_URL || '.tellform.com'
},
assets: {
bower_js: 'public/dist/vendor.min.js',

View file

@ -16,7 +16,7 @@ module.exports = function (app, db) {
io = socketio(config.socketPort, { transports: ['websocket', 'polling'] });
}
if(process.env.DISABLE_CLUSTER_MODE !== "TRUE"){
if(config.disableClusterMode){
var redis = require('socket.io-redis');
io.adapter(redis( process.env.REDIS_URL || { host: process.env.REDIS_DB_PORT_6379_TCP_ADDR || '127.0.0.1' , port: process.env.REDIS_DB_PORT_6379_TCP_PORT || 6379 }));
}

View file

@ -2252,6 +2252,7 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$windo
$scope.formURL = "/#!/forms/" + $scope.myform._id;
if ($scope.myform.isLive) {
if ($window.subdomainsDisabled == true) {
$scope.actualFormURL = window.location.protocol + '//' + window.location.host + '/view' + $scope.formURL;
} else {
@ -2261,6 +2262,10 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$windo
$scope.actualFormURL = window.location.protocol + '//' + $scope.myform.admin.username + '.' + window.location.host.split('.').slice(1, 3).join('.') + $scope.formURL;
}
}
} else {
$scope.actualFormURL = window.location.protocol + '//' + window.location.host + $scope.formURL;
}
var refreshFrame = $scope.refreshFrame = function(){
if(document.getElementById('iframe')) {

File diff suppressed because one or more lines are too long

View file

@ -25,6 +25,7 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$windo
$scope.formURL = "/#!/forms/" + $scope.myform._id;
if ($scope.myform.isLive) {
if ($window.subdomainsDisabled == true) {
$scope.actualFormURL = window.location.protocol + '//' + window.location.host + '/view' + $scope.formURL;
} else {
@ -34,6 +35,10 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$windo
$scope.actualFormURL = window.location.protocol + '//' + $scope.myform.admin.username + '.' + window.location.host.split('.').slice(1, 3).join('.') + $scope.formURL;
}
}
} else {
$scope.actualFormURL = window.location.protocol + '//' + window.location.host + $scope.formURL;
}
var refreshFrame = $scope.refreshFrame = function(){
if(document.getElementById('iframe')) {