diff --git a/src/views/apps.html b/src/views/apps.html index 6bc5f5adf..b106e0b3e 100644 --- a/src/views/apps.html +++ b/src/views/apps.html @@ -112,24 +112,26 @@
- -
{{appConfigure.error.mailboxName}}
+ + +
{{ appConfigure.error.mailboxName }}
- +
-
-
{{ appConfigure.error.alternateDomains }}
+
{{ appConfigure.error.alternateDomains }}
+
diff --git a/src/views/apps.js b/src/views/apps.js index 1915d9ff3..254131a34 100644 --- a/src/views/apps.js +++ b/src/views/apps.js @@ -36,6 +36,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location accessRestriction: { users: [], groups: [] }, xFrameOptions: '', alternateDomainEnabled: false, + mailboxNameEnabled: false, alternateSubdomain: '', alternateDomain: null, ssoAuth: false, @@ -64,6 +65,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location $scope.appConfigure.alternateDomain = app.alternateDomains[0] ? $scope.domains.filter(function (d) { return d.domain === app.alternateDomains[0].domain; })[0] : $scope.appConfigure.domain; $scope.appConfigure.robotsTxt = app.robotsTxt; $scope.appConfigure.enableBackup = app.enableBackup; + $scope.appConfigure.mailboxNameEnabled = app.mailboxName && (app.mailboxName.match(/\.app$/) === null); $scope.appConfigure.mailboxName = app.mailboxName || ''; $scope.appConfigure.ssoAuth = (app.manifest.addons['ldap'] || app.manifest.addons['oauth']) && app.sso; @@ -146,13 +148,17 @@ angular.module('Application').controller('AppsController', ['$scope', '$location // The backend supports multiple alternateDomains, however we only have ui for one if ($scope.appConfigure.alternateDomainEnabled) data.alternateDomains = [{ domain: $scope.appConfigure.alternateDomain.domain, subdomain: $scope.appConfigure.alternateSubdomain }]; - if ($scope.appConfigure.mailboxName !== $scope.appConfigure.app.mailboxName) data.mailboxName = $scope.appConfigure.mailboxName; + if ($scope.appConfigure.mailboxNameEnabled) { + data.mailboxName = $scope.appConfigure.mailboxName; + } else { // setting to empty will reset to .app name + data.mailboxName = ''; + } Client.configureApp($scope.appConfigure.app.id, data, function (error) { if (error) { if (error.statusCode === 409 && (error.message.indexOf('is reserved') !== -1 || error.message.indexOf('is already in use') !== -1)) { $scope.appConfigure.error.port = error.message; - } else if (error.statusCode === 409 && error.message.indexOf('mailbox') !== -1 ) { + } else if (error.statusCode === 400 && error.message.indexOf('mailbox') !== -1 ) { $scope.appConfigure.error.mailboxName = error.message; $scope.appConfigureForm.mailboxName.$setPristine(); $('#appConfigureMailboxNameInput').focus();