getDnsConfig only if admin

This commit is contained in:
Girish Ramakrishnan
2017-04-18 14:41:02 -07:00
parent 4bda11edcf
commit a3ece64273

View File

@@ -70,12 +70,21 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
};
function runConfigurationChecks() {
// Check if all email DNS records are set up properly for non external DNS API
Client.getDnsConfig(function (error, result) {
if (error) return console.error(error);
// check if we have aws credentials if selfhosting
if ($scope.config.isCustomDomain) {
if (result.provider === 'route53' && (!result.accessKeyId || !result.secretAccessKey)) {
var actionScope = $scope.$new(true);
actionScope.action = '/#/certs';
Client.notify('Missing AWS credentials', 'Please provide AWS credentials, click here to add them.', true, 'error', actionScope);
}
}
if (result.provider === 'caas') return;
// Check if all email DNS records are set up properly only for non external DNS API
Client.getEmailStatus(function (error, result) {
if (error) return console.error(error);
@@ -147,19 +156,6 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
$scope.initialized = true;
// check if we have aws credentials if selfhosting
if ($scope.config.isCustomDomain) {
Client.getDnsConfig(function (error, result) {
if (error) return console.error(error);
if (result.provider === 'route53' && (!result.accessKeyId || !result.secretAccessKey)) {
var actionScope = $scope.$new(true);
actionScope.action = '/#/certs';
Client.notify('Missing AWS credentials', 'Please provide AWS credentials, click here to add them.', true, 'error', actionScope);
}
});
}
if ($scope.user.admin) runConfigurationChecks();
});
});