Reenable and provision the catchall dropdown
This commit is contained in:
@@ -10,9 +10,9 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
$scope.config = Client.getConfig();
|
||||
|
||||
$scope.domains = [];
|
||||
$scope.users = [];
|
||||
$scope.selectedDomain = null;
|
||||
|
||||
$scope.rbl = null;
|
||||
$scope.expectedDnsRecords = {
|
||||
mx: { },
|
||||
dkim: { },
|
||||
@@ -27,7 +27,6 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
{ name: 'DMARC', value: 'dmarc' },
|
||||
{ name: 'PTR', value: 'ptr' }
|
||||
];
|
||||
$scope.users = [];
|
||||
|
||||
$scope.showView = function (view) {
|
||||
// wait for dialog to be fully closed to avoid modal behavior breakage when moving to a different view already
|
||||
@@ -45,12 +44,13 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
|
||||
$scope.catchall = {
|
||||
addresses: [],
|
||||
availableAddresses: [],
|
||||
busy: false,
|
||||
|
||||
submit: function () {
|
||||
$scope.catchall.busy = true;
|
||||
|
||||
Client.setCatchallAddresses($scope.catchall.addresses, function (error) {
|
||||
Client.setCatchallAddresses($scope.selectedDomain.domain, $scope.catchall.addresses, function (error) {
|
||||
if (error) console.error('Unable to add catchall address.', error);
|
||||
|
||||
$scope.catchall.busy = false;
|
||||
@@ -266,6 +266,14 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
}
|
||||
}
|
||||
|
||||
// catch-all, only allow users with a Cloudron email address
|
||||
$scope.catchall.availableAddresses = $scope.users.filter(function (u) { return !!u.username && !!u.email; }).map(function (u) { return u.username; });
|
||||
|
||||
// dedupe in case to avoid angular breakage
|
||||
$scope.catchall.addresses = mailConfig.catchAll.filter(function(item, pos, self) {
|
||||
return self.indexOf(item) == pos;
|
||||
});
|
||||
|
||||
// amend to selected domain to be available for the UI
|
||||
$scope.selectedDomain.mailConfig = mailConfig;
|
||||
$scope.selectedDomain.mailStatus = {};
|
||||
@@ -278,6 +286,8 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
|
||||
$scope.selectedDomain.mailStatus = mailStatus;
|
||||
|
||||
console.log($scope.selectedDomain)
|
||||
|
||||
showExpectedDnsRecords();
|
||||
});
|
||||
});
|
||||
@@ -301,31 +311,24 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
});
|
||||
};
|
||||
|
||||
function getCatchallAddresses() {
|
||||
Client.getCatchallAddresses(function (error, result) {
|
||||
if (error) return console.error('Unable to get catchall address listing.', error);
|
||||
Client.onReady(function () {
|
||||
Client.getUsers(function (error, users) {
|
||||
if (error) return console.error('Unable to get user listing.', error);
|
||||
|
||||
// dedupe in case to avoid angular breakage
|
||||
$scope.catchall.addresses = result.filter(function(item, pos, self) {
|
||||
return self.indexOf(item) == pos;
|
||||
$scope.users = users;
|
||||
|
||||
Client.getDomains(function (error, domains) {
|
||||
if (error) return console.error('Unable to get domain listing.', error);
|
||||
|
||||
$scope.domains = domains;
|
||||
$scope.selectedDomain = $scope.domains[0];
|
||||
|
||||
$scope.refreshDomain();
|
||||
|
||||
$scope.ready = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Client.onReady(function () {
|
||||
Client.getDomains(function (error, domains) {
|
||||
if (error) return console.error('Unable to get domain listing.', error);
|
||||
|
||||
$scope.domains = domains;
|
||||
$scope.selectedDomain = $scope.domains[0];
|
||||
|
||||
$scope.refreshDomain();
|
||||
|
||||
$scope.ready = true;
|
||||
});
|
||||
|
||||
// only allow users with a Cloudron email address
|
||||
// $scope.catchall.availableAddresses = result.filter(function (u) { return !!u.email; }).map(function (u) { return u.username; });
|
||||
});
|
||||
|
||||
// setup all the dialog focus handling
|
||||
|
||||
Reference in New Issue
Block a user