Added message when private form is accessed

This commit is contained in:
David Baldwynn 2017-07-25 18:08:25 -04:00
parent 6afa2b5e24
commit c59060b658
11 changed files with 96 additions and 715 deletions

View file

@ -173,8 +173,8 @@ exports.readForRender = function(req, res) {
var newForm = req.form.toJSON(); var newForm = req.form.toJSON();
if (!newForm.isLive && !req.user) { if (!newForm.isLive && !req.user) {
return res.status(404).send({ return res.status(401).send({
message: 'Form Does Not Exist' message: 'Form is Not Public'
}); });
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -5,6 +5,6 @@ angular.module('view-form').controller('SubmitFormController', [
'$scope', '$rootScope', '$state', '$translate', 'myForm', '$scope', '$rootScope', '$state', '$translate', 'myForm',
function($scope, $rootScope, $state, $translate, myForm) { function($scope, $rootScope, $state, $translate, myForm) {
$scope.myform = myForm; $scope.myform = myForm;
$translate.use(myForm.language); $translate.use(myForm.language);
} }
]); ]);

View file

@ -0,0 +1,10 @@
<section class="auth sigin-view valign-wrapper">
<div class="row valign">
<h3 class="col-md-12 text-center">Not Authorized to Access Form</h3>
<div class="col-md-4 col-md-offset-4">
<div class="col-md-12 text-center" style="padding-bottom: 50px;">
The form you are trying to access is currently private and not accesible publically. <br> If you are the owner of the form, you can set it to "Public" in the "Configuration" panel in the form admin.
</div>
</div>
</div>
</section>

View file

@ -10,12 +10,26 @@ angular.module('view-form').config(['$stateProvider',
templateUrl: '/static/form_modules/forms/base/views/submit-form.client.view.html', templateUrl: '/static/form_modules/forms/base/views/submit-form.client.view.html',
resolve: { resolve: {
Forms: 'Forms', Forms: 'Forms',
myForm: function (Forms, $stateParams) { myForm: function (Forms, $q, $state, $stateParams) {
return Forms.get({formId: $stateParams.formId}).$promise; var deferred = $q.defer();
console.log(Forms.get({formId: $stateParams.formId}).$promise);
return Forms.get({formId: $stateParams.formId}).$promise.then(function(data) {
console.log(data);
return data;
}, function(reason) {
console.log(reason);
$state.go('unauthorizedFormAccess');
return deferred.reject({redirectTo: 'unauthorizedFormAccess'});
});
//return Forms.get({formId: $stateParams.formId}).$promise;
} }
}, },
controller: 'SubmitFormController', controller: 'SubmitFormController',
controllerAs: 'ctrl' controllerAs: 'ctrl'
}); }).
} state('unauthorizedFormAccess', {
url: '/forms/unauthorized',
templateUrl: '/static/form_modules/forms/base/views/form-unauthorized.client.view.html',
});
}
]); ]);