Check dns records for generic dns providers

This commit is contained in:
Dennis Schwerdel
2016-12-09 09:19:23 +01:00
committed by Johannes Zellner
parent e58068688c
commit 1065b56380
8 changed files with 121 additions and 5 deletions

View File

@@ -282,18 +282,39 @@
<div class="card" style="margin-bottom: 15px;">
<div class="row">
<div class="col-md-12">
<p>Cloudron has a built-in email server that allows users to send and receive email for your domain. Apps can still send email regardless of this setting.</p>
<span>Cloudron has a built-in email server that allows users to send and receive email for your domain. Apps can still send email regardless of this setting. When enabled, your DNS will be configured automatically.</span>
<p>The <a href="https://cloudron.io/references/usermanual.html#email" target="_blank">User manual</a> has information on how to setup your mail client.</p>
</div>
</div>
<br/>
<div class="row">
<div class="col-md-12" ng-show="!config.isDev && (dnsConfig.provider === 'noop' || dnsConfig.provider === 'caas')">
<b>Email can only be enabled for custom domains with a DNS provider setup.</b>
<button ng-class="mailConfig.enabled ? 'btn btn-danger pull-right' : 'btn btn-primary pull-right'" ng-click="toggleEmail()" ng-enabled="mailConfig">{{ mailConfig.enabled ? "Disable Email" : "Enable Email" }}</button>
</div>
</div>
<br/>
<div class="row">
<p class="col-md-12" ng-show="!config.isDev && (dnsConfig.provider === 'noop' || dnsConfig.provider === 'caas')">
Please make sure to set the following DNS records for <b><tt>{{ config.fqdn }}</tt></b> to guarentee proper email functionality.
</div>
<div class="col-md-12" ng-show="config.isDev || !(dnsConfig.provider === 'noop' || dnsConfig.provider === 'caas')">
<button ng-class="mailConfig.enabled ? 'btn btn-danger pull-right' : 'btn btn-primary pull-right'" ng-click="email.toggle()" ng-enabled="mailConfig">{{ mailConfig.enabled ? "Disable Email" : "Enable Email" }}</button>
<div class="col-xs-12">
<div ng-repeat="record in expectedDnsRecordsTypes">
<div class="row">
<div class="col-xs-12">
<h4 class="text-muted">{{ record.name }} record <i ng-class="expectedDnsRecords[record.value].status ? 'fa fa-check-circle text-success' : 'fa fa-exclamation-triangle text-danger'" aria-hidden="true"></i></h4>
<a href="" data-toggle="collapse" data-parent="#accordion" data-target="#collapse_dns_{{ record.value }}">Advanced</a>
<div id="collapse_dns_{{ record.value }}" class="panel-collapse collapse">
<div class="panel-body">
<p>Subdomain: <b ng-click-select><tt>{{ expectedDnsRecords[record.value].subdomain }}</tt></b></p>
<p>Record type: <b ng-click-select><tt>{{ expectedDnsRecords[record.value].type }}</tt></b></p>
<p style="overflow: auto; white-space: nowrap;">Expected value: <b ng-click-select><tt>{{ expectedDnsRecords[record.value].expected }}</tt></b></p>
<p style="overflow: auto; white-space: nowrap;">Current value: <b ng-click-select><tt>{{ expectedDnsRecords[record.value].value ? expectedDnsRecords[record.value].value : '[not set]' }}</tt></b></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@@ -8,6 +8,11 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
$scope.config = Client.getConfig();
$scope.backupConfig = {};
$scope.dnsConfig = {};
$scope.expectedDnsRecords = {};
$scope.expectedDnsRecordsTypes = [
{ name: 'DKIM', value: 'dkim' },
{ name: 'SPF', value: 'spf' }
];
$scope.appstoreConfig = {};
$scope.mailConfig = null;
@@ -423,6 +428,14 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
});
}
function getExpectedDnsRecords() {
Client.getExpectedDnsRecords(function (error, dnsRecords) {
if (error) return console.error(error);
$scope.expectedDnsRecords = dnsRecords;
});
}
function getPlans() {
AppStore.getSizes(function (error, result) {
if (error) return console.error(error);
@@ -521,6 +534,7 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
getMailConfig();
getBackupConfig();
getDnsConfig();
getExpectedDnsRecords();
if ($scope.config.provider === 'caas') {
getPlans();