Allow mailbox name to be configured

part of cloudron/box#558
This commit is contained in:
Girish Ramakrishnan
2018-05-24 15:40:26 -07:00
parent 9d9f16e948
commit a94f5daac9
2 changed files with 16 additions and 1 deletions

View File

@@ -29,6 +29,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
keyFileName: '',
memoryLimit: 0,
memoryTicks: [],
mailboxName: '',
accessRestrictionOption: 'any',
accessRestriction: { users: [], groups: [] },
@@ -54,6 +55,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
$scope.appConfigure.customAuth = !(app.manifest.addons['ldap'] || app.manifest.addons['oauth']);
$scope.appConfigure.robotsTxt = app.robotsTxt;
$scope.appConfigure.enableBackup = app.enableBackup;
$scope.appConfigure.mailboxName = app.mailboxName || '';
// create ticks starting from manifest memory limit. the memory limit here is currently split into ram+swap (and thus *2 below)
// TODO: the *2 will overallocate since 4GB is max swap that cloudron itself allocates
@@ -98,6 +100,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.mailboxName = null;
// only use enabled ports from portBindings
var finalPortBindings = {};
@@ -127,6 +130,8 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
enableBackup: $scope.appConfigure.enableBackup
};
if ($scope.appConfigure.mailboxName) data.mailboxName = $scope.appConfigure.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)) {
@@ -145,6 +150,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('mailbox') !== -1 ) {
$scope.appConfigure.error.mailboxName = error.message;
$scope.appConfigureForm.mailboxName.$setPristine();
$('#appConfigureMailboxNameInput').focus();
} else {
$scope.appConfigure.error.other = error.message;
}