DKIM Manager for Domains.

This commit is contained in:
usmannasir
2018-05-03 01:22:28 +05:00
parent 69a9dcd3d2
commit f0eba42696
14 changed files with 1525 additions and 611 deletions

View File

@@ -63,7 +63,7 @@ app.controller('createEmailAccount', function($scope,$http) {
function ListInitialDatas(response) {
if(response.data.createEmailStatus == 1){
if(response.data.createEmailStatus === 1){
$scope.emailDetails = false;
$scope.emailLoading = true;
@@ -508,3 +508,322 @@ app.controller('changeEmailPassword', function($scope,$http) {
});
/* Java script code to create account ends here */
/* Java script code for DKIM Manager */
app.controller('dkimManager', function($scope, $http, $timeout, $window) {
$scope.manageDKIMLoading = true;
$scope.dkimError = true;
$scope.dkimSuccess = true;
$scope.couldNotConnect = true;
$scope.domainRecords = true;
$scope.noKeysAvailable = true;
$scope.fetchKeys = function(){
$scope.manageDKIMLoading = false;
$scope.dkimError = true;
$scope.dkimSuccess = true;
$scope.couldNotConnect = true;
$scope.domainRecords = true;
$scope.noKeysAvailable = true;
url = "/email/fetchDKIMKeys";
var data = {
domainName: $scope.domainName
};
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if(response.data.fetchStatus === 1){
if(response.data.keysAvailable === 1){
$scope.manageDKIMLoading = true;
$scope.dkimError = true;
$scope.dkimSuccess = false;
$scope.couldNotConnect = true;
$scope.domainRecords = false;
$scope.noKeysAvailable = true;
$scope.privateKey = response.data.privateKey;
$scope.publicKey = response.data.publicKey;
$scope.dkimSuccessMessage = response.data.dkimSuccessMessage;
}else{
$scope.manageDKIMLoading = true;
$scope.dkimError = true;
$scope.dkimSuccess = true;
$scope.couldNotConnect = true;
$scope.domainRecords = true;
$scope.noKeysAvailable = false;
}
}
else{
$scope.errorMessage = response.data.error_message;
$scope.manageDKIMLoading = true;
$scope.dkimError = false;
$scope.dkimSuccess = true;
$scope.couldNotConnect = true;
$scope.domainRecords = true;
$scope.noKeysAvailable = true;
}
}
function cantLoadInitialDatas(response) {
$scope.manageDKIMLoading = true;
$scope.dkimError = true;
$scope.dkimSuccess = true;
$scope.couldNotConnect = false;
$scope.domainRecords = true;
$scope.noKeysAvailable = true;
}
};
$scope.createDomainDKIMKeys = function () {
$scope.manageDKIMLoading = false;
$scope.dkimError = true;
$scope.dkimSuccess = true;
$scope.couldNotConnect = true;
$scope.domainRecords = true;
$scope.noKeysAvailable = false;
url = "/email/generateDKIMKeys";
var data = {
domainName: $scope.domainName
};
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if(response.data.generateStatus === 1){
$scope.manageDKIMLoading = true;
$scope.dkimError = true;
$scope.dkimSuccess = true;
$scope.couldNotConnect = true;
$scope.domainRecords = true;
$scope.noKeysAvailable = true;
$scope.fetchKeys();
}
else{
$scope.errorMessage = response.data.error_message;
$scope.manageDKIMLoading = true;
$scope.dkimError = false;
$scope.dkimSuccess = true;
$scope.couldNotConnect = true;
$scope.domainRecords = true;
$scope.noKeysAvailable = false;
}
}
function cantLoadInitialDatas(response) {
$scope.manageDKIMLoading = true;
$scope.dkimError = true;
$scope.dkimSuccess = true;
$scope.couldNotConnect = false;
$scope.domainRecords = true;
$scope.noKeysAvailable = true;
}
};
// Installation
$scope.openDKIMNotifyBox = true;
$scope.openDKIMError = true;
$scope.couldNotConnect = true;
$scope.openDKIMSuccessfullyInstalled = true;
$scope.openDKIMInstallBox = true;
$scope.manageDKIMLoading = true;
$scope.installOpenDKIM = function(){
$scope.openDKIMNotifyBox = true;
$scope.openDKIMError = true;
$scope.couldNotConnect = true;
$scope.openDKIMSuccessfullyInstalled = true;
$scope.openDKIMInstallBox = true;
$scope.manageDKIMLoading = false;
url = "/email/installOpenDKIM";
var data = {};
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if(response.data.installOpenDKIM === 1){
$scope.openDKIMNotifyBox = true;
$scope.openDKIMError = true;
$scope.couldNotConnect = true;
$scope.openDKIMSuccessfullyInstalled = true;
$scope.openDKIMInstallBox = false;
$scope.manageDKIMLoading = true;
getRequestStatus();
}
else{
$scope.errorMessage = response.data.error_message;
$scope.openDKIMNotifyBox = false;
$scope.openDKIMError = false;
$scope.couldNotConnect = true;
$scope.openDKIMSuccessfullyInstalled = true;
$scope.openDKIMInstallBox = true;
$scope.manageDKIMLoading = true;
}
}
function cantLoadInitialDatas(response) {
$scope.openDKIMNotifyBox = false;
$scope.openDKIMError = true;
$scope.couldNotConnect = false;
$scope.openDKIMSuccessfullyInstalled = true;
$scope.openDKIMInstallBox = true;
$scope.manageDKIMLoading = false;
}
};
function getRequestStatus(){
$scope.openDKIMNotifyBox = true;
$scope.openDKIMError = true;
$scope.couldNotConnect = true;
$scope.openDKIMSuccessfullyInstalled = true;
$scope.openDKIMInstallBox = false;
$scope.manageDKIMLoading = false;
url = "/email/installStatusOpenDKIM";
var data = {};
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if(response.data.abort === 0){
$scope.requestData = response.data.requestStatus;
$timeout(getRequestStatus,1000);
}
else{
// Notifications
$timeout.cancel();
$scope.openDKIMNotifyBox = false;
$scope.openDKIMError = true;
$scope.couldNotConnect = true;
$scope.openDKIMSuccessfullyInstalled = true;
$scope.openDKIMInstallBox = true;
$scope.manageDKIMLoading = true;
$scope.requestData = response.data.requestStatus;
if(response.data.installed === 0) {
$scope.openDKIMError = false;
$scope.errorMessage = response.data.error_message;
}else{
$scope.openDKIMSuccessfullyInstalled = false;
$timeout(function() { $window.location.reload(); }, 3000);
}
}
}
function cantLoadInitialDatas(response) {
$scope.modSecNotifyBox = false;
$scope.modeSecInstallBox = false;
$scope.modsecLoading = true;
$scope.failedToStartInallation = true;
$scope.couldNotConnect = false;
$scope.modSecSuccessfullyInstalled = true;
$scope.installationFailed = true;
}
}
});