Add support for one alternate domain which redirects

This commit is contained in:
Johannes Zellner
2018-06-29 16:38:40 +02:00
parent 0697274311
commit cd3fb77033
3 changed files with 33 additions and 1 deletions

View File

@@ -34,6 +34,8 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
accessRestrictionOption: 'any',
accessRestriction: { users: [], groups: [] },
xFrameOptions: '',
alternateSubdomain: '',
alternateDomain: '',
ssoAuth: false,
isAccessRestrictionValid: function () {
@@ -51,6 +53,8 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
$scope.appConfigure.portBindingsInfo = app.manifest.tcpPorts || {}; // Portbinding map only for information
$scope.appConfigure.memoryLimit = app.memoryLimit || app.manifest.memoryLimit || (256 * 1024 * 1024);
$scope.appConfigure.xFrameOptions = app.xFrameOptions.indexOf('ALLOW-FROM') === 0 ? app.xFrameOptions.split(' ')[1] : '';
$scope.appConfigure.alternateSubdomain = app.alternateDomains[0] ? app.alternateDomains[0].subdomain : '';
$scope.appConfigure.alternateDomain = app.alternateDomains[0] ? app.alternateDomains[0].domain : '';
$scope.appConfigure.robotsTxt = app.robotsTxt;
$scope.appConfigure.enableBackup = app.enableBackup;
$scope.appConfigure.mailboxName = app.mailboxName || '';
@@ -100,6 +104,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
$scope.appConfigure.error.other = null;
$scope.appConfigure.error.location = null;
$scope.appConfigure.error.xFrameOptions = null;
$scope.appConfigure.error.alternateDomains = null;
$scope.appConfigure.error.mailboxName = null;
// only use enabled ports from portBindings
@@ -130,6 +135,9 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
enableBackup: $scope.appConfigure.enableBackup
};
// The backend supports multiple alternateDomains, however we only have ui for one
if ($scope.appConfigure.alternateDomain) data.alternateDomains = [{ domain: $scope.appConfigure.alternateDomain, subdomain: $scope.appConfigure.alternateSubdomain }];
if ($scope.appConfigure.mailboxName !== $scope.appConfigure.app.mailboxName) data.mailboxName = $scope.appConfigure.mailboxName;
Client.configureApp($scope.appConfigure.app.id, data, function (error) {
@@ -154,6 +162,10 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
$scope.appConfigure.error.xFrameOptions = error.message;
$scope.appConfigureForm.xFrameOptions.$setPristine();
$('#appConfigureXFrameOptionsInput').focus();
} else if (error.statusCode === 400 && error.message.indexOf('alternateDomains') !== -1 ) {
$scope.appConfigure.error.alternateDomains = error.message;
$scope.appConfigureForm.alternateDomains.$setPristine();
$('#appConfigureAlternateSubdomainInput').focus();
} else {
$scope.appConfigure.error.other = error.message;
}