mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 13:56:01 +01:00
Bug fix to Backups.
This commit is contained in:
@@ -125,6 +125,7 @@ app.controller('adminController', function($scope,$http,$timeout) {
|
|||||||
$("#normalUserG").hide();
|
$("#normalUserG").hide();
|
||||||
$("#normalUserH").hide();
|
$("#normalUserH").hide();
|
||||||
$("#normalUserP").hide();
|
$("#normalUserP").hide();
|
||||||
|
$("#normalUserI").hide();
|
||||||
|
|
||||||
$("#ssl").hide();
|
$("#ssl").hide();
|
||||||
$("#sslA").hide();
|
$("#sslA").hide();
|
||||||
|
|||||||
@@ -548,7 +548,7 @@
|
|||||||
</div><!-- .sidebar-submenu -->
|
</div><!-- .sidebar-submenu -->
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="normalUserE">
|
<li id="normalUserI">
|
||||||
<a href="#" title="{% trans 'Mail Settings' %}">
|
<a href="#" title="{% trans 'Mail Settings' %}">
|
||||||
<i class="glyph-icon icon-linecons-fire"></i>
|
<i class="glyph-icon icon-linecons-fire"></i>
|
||||||
<span>{% trans "Mail Settings" %}</span>
|
<span>{% trans "Mail Settings" %}</span>
|
||||||
|
|||||||
Binary file not shown.
@@ -34,7 +34,7 @@ def listDomains(request):
|
|||||||
if admin.type == 1:
|
if admin.type == 1:
|
||||||
websites = Websites.objects.all()
|
websites = Websites.objects.all()
|
||||||
else:
|
else:
|
||||||
websites = Websites.objects.filter(admin=admin)
|
return HttpResponse("Only administrator can view this page.")
|
||||||
|
|
||||||
|
|
||||||
pages = float(len(websites)) / float(10)
|
pages = float(len(websites)) / float(10)
|
||||||
@@ -84,15 +84,14 @@ def getFurtherDomains(request):
|
|||||||
websites = Websites.objects.all()[finalPageNumber:endPageNumber]
|
websites = Websites.objects.all()[finalPageNumber:endPageNumber]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
finalPageNumber = ((pageNumber * 10)) - 10
|
final_dic = {'listWebSiteStatus': 0, 'error_message': "Only administrator can view this page."}
|
||||||
endPageNumber = finalPageNumber + 10
|
final_json = json.dumps(final_dic)
|
||||||
websites = Websites.objects.filter(admin=admin)[finalPageNumber:endPageNumber]
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
json_data = "["
|
json_data = "["
|
||||||
checker = 0
|
checker = 0
|
||||||
|
|
||||||
for items in websites:
|
for items in websites:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
domain = Domains.objects.get(domainOwner=items)
|
domain = Domains.objects.get(domainOwner=items)
|
||||||
domainLimits = DomainLimits.objects.get(domain=domain)
|
domainLimits = DomainLimits.objects.get(domain=domain)
|
||||||
@@ -112,8 +111,6 @@ def getFurtherDomains(request):
|
|||||||
json_data = json_data + ']'
|
json_data = json_data + ']'
|
||||||
final_dic = {'listWebSiteStatus': 1, 'error_message': "None", "data": json_data}
|
final_dic = {'listWebSiteStatus': 1, 'error_message': "None", "data": json_data}
|
||||||
final_json = json.dumps(final_dic)
|
final_json = json.dumps(final_dic)
|
||||||
|
|
||||||
|
|
||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
except BaseException,msg:
|
except BaseException,msg:
|
||||||
@@ -134,6 +131,13 @@ def enableDisableEmailLimits(request):
|
|||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
|
||||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||||
|
|
||||||
|
if admin.type != 1:
|
||||||
|
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||||
|
json_data = json.dumps(dic)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
operationVal = data['operationVal']
|
operationVal = data['operationVal']
|
||||||
domainName = data['domainName']
|
domainName = data['domainName']
|
||||||
@@ -166,9 +170,13 @@ def enableDisableEmailLimits(request):
|
|||||||
def emailLimits(request,domain):
|
def emailLimits(request,domain):
|
||||||
try:
|
try:
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
|
|
||||||
admin = Administrator.objects.get(pk=val)
|
admin = Administrator.objects.get(pk=val)
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||||
|
|
||||||
|
if admin.type != 1:
|
||||||
|
return HttpResponse("Only administrator can view this page.")
|
||||||
|
|
||||||
|
|
||||||
if Websites.objects.filter(domain=domain).exists():
|
if Websites.objects.filter(domain=domain).exists():
|
||||||
if admin.type == 1:
|
if admin.type == 1:
|
||||||
@@ -189,7 +197,6 @@ def emailLimits(request,domain):
|
|||||||
Data['limitsOn'] = 0
|
Data['limitsOn'] = 0
|
||||||
Data['limitsOff'] = 1
|
Data['limitsOff'] = 1
|
||||||
|
|
||||||
|
|
||||||
## Pagination for emails
|
## Pagination for emails
|
||||||
|
|
||||||
|
|
||||||
@@ -226,6 +233,12 @@ def changeDomainLimit(request):
|
|||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
|
||||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||||
|
|
||||||
|
if admin.type != 1:
|
||||||
|
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||||
|
json_data = json.dumps(dic)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
newLimit = data['newLimit']
|
newLimit = data['newLimit']
|
||||||
domainName = data['domainName']
|
domainName = data['domainName']
|
||||||
@@ -260,6 +273,12 @@ def getFurtherEmail(request):
|
|||||||
try:
|
try:
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||||
|
|
||||||
|
if admin.type != 1:
|
||||||
|
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||||
|
json_data = json.dumps(dic)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
status = data['page']
|
status = data['page']
|
||||||
domainName = data['domainName']
|
domainName = data['domainName']
|
||||||
@@ -314,6 +333,13 @@ def enableDisableIndividualEmailLimits(request):
|
|||||||
try:
|
try:
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||||
|
|
||||||
|
if admin.type != 1:
|
||||||
|
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||||
|
json_data = json.dumps(dic)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
operationVal = data['operationVal']
|
operationVal = data['operationVal']
|
||||||
emailAddress = data['emailAddress']
|
emailAddress = data['emailAddress']
|
||||||
@@ -343,9 +369,11 @@ def enableDisableIndividualEmailLimits(request):
|
|||||||
def emailPage(request, emailAddress):
|
def emailPage(request, emailAddress):
|
||||||
try:
|
try:
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
|
|
||||||
admin = Administrator.objects.get(pk=val)
|
admin = Administrator.objects.get(pk=val)
|
||||||
|
|
||||||
|
if admin.type != 1:
|
||||||
|
return HttpResponse("Only administrator can view this page.")
|
||||||
|
|
||||||
Data = {}
|
Data = {}
|
||||||
Data['emailAddress'] = emailAddress
|
Data['emailAddress'] = emailAddress
|
||||||
|
|
||||||
@@ -376,7 +404,14 @@ def getEmailStats(request):
|
|||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
try:
|
try:
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
|
||||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||||
|
|
||||||
|
if admin.type != 1:
|
||||||
|
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||||
|
json_data = json.dumps(dic)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
emailAddress = data['emailAddress']
|
emailAddress = data['emailAddress']
|
||||||
|
|
||||||
@@ -411,6 +446,13 @@ def enableDisableIndividualEmailLogs(request):
|
|||||||
try:
|
try:
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||||
|
|
||||||
|
if admin.type != 1:
|
||||||
|
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||||
|
json_data = json.dumps(dic)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
operationVal = data['operationVal']
|
operationVal = data['operationVal']
|
||||||
emailAddress = data['emailAddress']
|
emailAddress = data['emailAddress']
|
||||||
@@ -444,6 +486,12 @@ def changeDomainEmailLimitsIndividual(request):
|
|||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
|
||||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||||
|
|
||||||
|
if admin.type != 1:
|
||||||
|
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||||
|
json_data = json.dumps(dic)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
emailAddress = data['emailAddress']
|
emailAddress = data['emailAddress']
|
||||||
monthlyLimit = data['monthlyLimit']
|
monthlyLimit = data['monthlyLimit']
|
||||||
@@ -511,6 +559,12 @@ def getEmailLogs(request):
|
|||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
|
||||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||||
|
|
||||||
|
if admin.type != 1:
|
||||||
|
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||||
|
json_data = json.dumps(dic)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
status = data['page']
|
status = data['page']
|
||||||
emailAddress = data['emailAddress']
|
emailAddress = data['emailAddress']
|
||||||
@@ -559,6 +613,13 @@ def flushEmailLogs(request):
|
|||||||
try:
|
try:
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||||
|
|
||||||
|
if admin.type != 1:
|
||||||
|
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||||
|
json_data = json.dumps(dic)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
emailAddress = data['emailAddress']
|
emailAddress = data['emailAddress']
|
||||||
|
|
||||||
@@ -587,6 +648,10 @@ def flushEmailLogs(request):
|
|||||||
def spamAssassinHome(request):
|
def spamAssassinHome(request):
|
||||||
try:
|
try:
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
|
admin = Administrator.objects.get(pk=val)
|
||||||
|
|
||||||
|
if admin.type != 1:
|
||||||
|
return HttpResponse("Only administrator can view this page.")
|
||||||
|
|
||||||
checkIfSpamAssassinInstalled = 0
|
checkIfSpamAssassinInstalled = 0
|
||||||
|
|
||||||
@@ -602,6 +667,14 @@ def installSpamAssassin(request):
|
|||||||
try:
|
try:
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
try:
|
try:
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||||
|
|
||||||
|
if admin.type != 1:
|
||||||
|
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||||
|
json_data = json.dumps(dic)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
thread.start_new_thread(mailUtilities.installSpamAssassin, ('Install','SpamAssassin'))
|
thread.start_new_thread(mailUtilities.installSpamAssassin, ('Install','SpamAssassin'))
|
||||||
final_json = json.dumps({'status': 1, 'error_message': "None"})
|
final_json = json.dumps({'status': 1, 'error_message': "None"})
|
||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
@@ -620,6 +693,13 @@ def installStatusSpamAssassin(request):
|
|||||||
try:
|
try:
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||||
|
|
||||||
|
if admin.type != 1:
|
||||||
|
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||||
|
json_data = json.dumps(dic)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
command = "sudo cat " + mailUtilities.spamassassinInstallLogPath
|
command = "sudo cat " + mailUtilities.spamassassinInstallLogPath
|
||||||
installStatus = subprocess.check_output(shlex.split(command))
|
installStatus = subprocess.check_output(shlex.split(command))
|
||||||
|
|
||||||
@@ -751,6 +831,13 @@ def saveSpamAssassinConfigurations(request):
|
|||||||
try:
|
try:
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||||
|
|
||||||
|
if admin.type != 1:
|
||||||
|
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||||
|
json_data = json.dumps(dic)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
|
|
||||||
report_safe = data['report_safe']
|
report_safe = data['report_safe']
|
||||||
|
|||||||
Binary file not shown.
@@ -271,9 +271,6 @@ def obtainMailServerSSL(request):
|
|||||||
|
|
||||||
execPath = execPath + " issueSSLForMailServer --virtualHostName " + virtualHost + " --path " + path
|
execPath = execPath + " issueSSLForMailServer --virtualHostName " + virtualHost + " --path " + path
|
||||||
|
|
||||||
logging.writeToFile(execPath)
|
|
||||||
|
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = subprocess.check_output(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
|
|||||||
@@ -1055,6 +1055,30 @@ class virtualHostUtilities:
|
|||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [getDiskUsage]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [getDiskUsage]")
|
||||||
return [int(0), int(0)]
|
return [int(0), int(0)]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def permissionControl(path):
|
||||||
|
try:
|
||||||
|
command = 'sudo chown -R cyberpanel:cyberpanel ' + path
|
||||||
|
|
||||||
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
|
res = subprocess.call(cmd)
|
||||||
|
|
||||||
|
except BaseException, msg:
|
||||||
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def leaveControl(path):
|
||||||
|
try:
|
||||||
|
command = 'sudo chown -R root:root ' + path
|
||||||
|
|
||||||
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
|
res = subprocess.call(cmd)
|
||||||
|
|
||||||
|
except BaseException, msg:
|
||||||
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='CyberPanel Installer')
|
parser = argparse.ArgumentParser(description='CyberPanel Installer')
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ app.controller('adminController', function($scope,$http,$timeout) {
|
|||||||
$("#normalUserG").hide();
|
$("#normalUserG").hide();
|
||||||
$("#normalUserH").hide();
|
$("#normalUserH").hide();
|
||||||
$("#normalUserP").hide();
|
$("#normalUserP").hide();
|
||||||
|
$("#normalUserI").hide();
|
||||||
|
|
||||||
$("#ssl").hide();
|
$("#ssl").hide();
|
||||||
$("#sslA").hide();
|
$("#sslA").hide();
|
||||||
|
|||||||
@@ -110,18 +110,23 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) {
|
|||||||
$scope.listFail = true;
|
$scope.listFail = true;
|
||||||
$scope.emailLimitsLoading = true;
|
$scope.emailLimitsLoading = true;
|
||||||
|
|
||||||
|
var globalDomainName = window.location.pathname.split("/")[2];
|
||||||
|
|
||||||
// Global page number, to be used in later function to refresh the domains
|
// Global page number, to be used in later function to refresh the domains
|
||||||
var globalPageNumber;
|
var globalPageNumber;
|
||||||
|
|
||||||
|
|
||||||
$scope.getFurtherWebsitesFromDB = function(pageNumber) {
|
$scope.getFurtherEmailsFromDB = function(pageNumber) {
|
||||||
|
|
||||||
globalPageNumber = pageNumber;
|
globalPageNumber = pageNumber;
|
||||||
$scope.emailLimitsLoading = false;
|
$scope.emailLimitsLoading = false;
|
||||||
|
|
||||||
url = "/emailPremium/getFurtherDomains";
|
url = "/emailPremium/getFurtherEmail";
|
||||||
|
|
||||||
var data = {page: pageNumber};
|
var data = {
|
||||||
|
page: pageNumber,
|
||||||
|
domainName: globalDomainName
|
||||||
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
headers : {
|
headers : {
|
||||||
@@ -136,9 +141,9 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) {
|
|||||||
|
|
||||||
$scope.emailLimitsLoading = true;
|
$scope.emailLimitsLoading = true;
|
||||||
|
|
||||||
if (response.data.listWebSiteStatus === 1) {
|
if (response.data.status === 1) {
|
||||||
|
|
||||||
$scope.WebSitesList = JSON.parse(response.data.data);
|
$scope.emailList = JSON.parse(response.data.data);
|
||||||
$scope.listFail = true;
|
$scope.listFail = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -155,7 +160,7 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) {
|
|||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
$scope.getFurtherWebsitesFromDB(1);
|
$scope.getFurtherEmailsFromDB(1);
|
||||||
|
|
||||||
$scope.enableDisableEmailLimits = function (operationVal, domainName) {
|
$scope.enableDisableEmailLimits = function (operationVal, domainName) {
|
||||||
|
|
||||||
@@ -183,17 +188,770 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) {
|
|||||||
|
|
||||||
if (response.data.status === 1) {
|
if (response.data.status === 1) {
|
||||||
|
|
||||||
|
$timeout(function() { $window.location.reload(); }, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$timeout(function() { $window.location.reload(); }, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function cantLoadInitialData(response) {
|
||||||
|
$timeout(function() { $window.location.reload(); }, 0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// Email limits
|
||||||
|
|
||||||
|
$scope.changeLimitsForm = true;
|
||||||
|
$scope.changeLimitsFail = true;
|
||||||
|
$scope.changeLimitsSuccess = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
|
||||||
|
$scope.showLimitsForm = function () {
|
||||||
|
$scope.changeLimitsForm = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.hideLimitsForm = function () {
|
||||||
|
$scope.changeLimitsForm = true;
|
||||||
|
$scope.changeLimitsFail = true;
|
||||||
|
$scope.changeLimitsSuccess = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.changeDomainEmailLimits = function (domainName) {
|
||||||
|
$scope.emailLimitsLoading = false;
|
||||||
|
|
||||||
|
url = "/emailPremium/changeDomainLimit";
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
domainName: domainName,
|
||||||
|
newLimit: $scope.monthlyLimit
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers : {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data,config).then(ListInitialData, cantLoadInitialData);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialData(response) {
|
||||||
|
|
||||||
|
$scope.emailLimitsLoading = true;
|
||||||
|
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
|
||||||
|
$scope.changeLimitsForm = false;
|
||||||
|
$scope.changeLimitsFail = true;
|
||||||
|
$scope.changeLimitsSuccess = false;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
$timeout(function() { $window.location.reload(); }, 3000);
|
$timeout(function() { $window.location.reload(); }, 3000);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$timeout(function() { $window.location.reload(); }, 3000);
|
$scope.changeLimitsForm = false;
|
||||||
|
$scope.changeLimitsFail = false;
|
||||||
|
$scope.changeLimitsSuccess = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
$scope.errorMessage = response.data.error_message;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function cantLoadInitialData(response) {
|
function cantLoadInitialData(response) {
|
||||||
$timeout(function() { $window.location.reload(); }, 3000);
|
$scope.emailLimitsLoading = true;
|
||||||
|
$scope.changeLimitsForm = false;
|
||||||
|
$scope.changeLimitsFail = true;
|
||||||
|
$scope.changeLimitsSuccess = true;
|
||||||
|
$scope.couldNotConnect = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$scope.enableDisableIndividualEmailLimits = function (operationVal, emailAddress) {
|
||||||
|
|
||||||
|
$scope.emailLimitsLoading = false;
|
||||||
|
|
||||||
|
|
||||||
|
url = "/emailPremium/enableDisableIndividualEmailLimits";
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
operationVal: operationVal,
|
||||||
|
emailAddress: emailAddress
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers : {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data,config).then(ListInitialData, cantLoadInitialData);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialData(response) {
|
||||||
|
$scope.emailLimitsLoading = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
$scope.getFurtherEmailsFromDB(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$scope.getFurtherEmailsFromDB(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function cantLoadInitialData(response) {
|
||||||
|
$scope.getFurtherEmailsFromDB(1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Java script code for email domain page */
|
/* Java script code for email domain page */
|
||||||
|
|
||||||
|
|
||||||
|
/* Java script code for Email Page */
|
||||||
|
|
||||||
|
app.controller('emailPage', function($scope,$http, $timeout, $window) {
|
||||||
|
|
||||||
|
$scope.emailLimitsLoading = true;
|
||||||
|
|
||||||
|
var globalEamilAddress = $("#emailAddress").text();
|
||||||
|
|
||||||
|
// Global page number, to be used in later function to refresh the domains
|
||||||
|
var globalPageNumber;
|
||||||
|
|
||||||
|
$scope.getEmailStats = function() {
|
||||||
|
|
||||||
|
$scope.emailLimitsLoading = false;
|
||||||
|
|
||||||
|
////
|
||||||
|
|
||||||
|
$scope.limitsOn = true;
|
||||||
|
$scope.limitsOff = true;
|
||||||
|
|
||||||
|
url = "/emailPremium/getEmailStats";
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
emailAddress: globalEamilAddress
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers : {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data,config).then(ListInitialData, cantLoadInitialData);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialData(response) {
|
||||||
|
|
||||||
|
$scope.emailLimitsLoading = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
|
||||||
|
$scope.monthlyLimit = response.data.monthlyLimit;
|
||||||
|
$scope.monthlyUsed = response.data.monthlyUsed;
|
||||||
|
$scope.hourlyLimit = response.data.hourlyLimit;
|
||||||
|
$scope.hourlyUsed = response.data.hourlyUsed;
|
||||||
|
|
||||||
|
if(response.data.limitStatus === 1){
|
||||||
|
$scope.limitsOn = false;
|
||||||
|
$scope.limitsOff = true;
|
||||||
|
}else{
|
||||||
|
$scope.limitsOn = true;
|
||||||
|
$scope.limitsOff = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(response.data.logsStatus === 1){
|
||||||
|
$scope.loggingOn = false;
|
||||||
|
$scope.loggingOff = true;
|
||||||
|
}else{
|
||||||
|
$scope.loggingOn = true;
|
||||||
|
$scope.loggingOff = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
$scope.errorMessage = response.data.error_message;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function cantLoadInitialData(response) {
|
||||||
|
$scope.emailLimitsLoading = true;
|
||||||
|
$scope.listFail = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
$scope.getEmailStats();
|
||||||
|
|
||||||
|
$scope.enableDisableIndividualEmailLimits = function (operationVal, emailAddress) {
|
||||||
|
|
||||||
|
$scope.emailLimitsLoading = false;
|
||||||
|
|
||||||
|
|
||||||
|
url = "/emailPremium/enableDisableIndividualEmailLimits";
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
operationVal: operationVal,
|
||||||
|
emailAddress: emailAddress
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers : {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data,config).then(ListInitialData, cantLoadInitialData);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialData(response) {
|
||||||
|
$scope.emailLimitsLoading = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
$scope.getEmailStats();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$scope.getEmailStats();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function cantLoadInitialData(response) {
|
||||||
|
$scope.getEmailStats();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$scope.enableDisableIndividualEmailLogs = function (operationVal, emailAddress) {
|
||||||
|
|
||||||
|
$scope.emailLimitsLoading = false;
|
||||||
|
|
||||||
|
|
||||||
|
url = "/emailPremium/enableDisableIndividualEmailLogs";
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
operationVal: operationVal,
|
||||||
|
emailAddress: emailAddress
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers : {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data,config).then(ListInitialData, cantLoadInitialData);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialData(response) {
|
||||||
|
$scope.emailLimitsLoading = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
$scope.getEmailStats();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$scope.getEmailStats();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function cantLoadInitialData(response) {
|
||||||
|
$scope.getEmailStats();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$scope.enableDisableEmailLimits = function (operationVal, domainName) {
|
||||||
|
|
||||||
|
$scope.emailLimitsLoading = false;
|
||||||
|
|
||||||
|
|
||||||
|
url = "/emailPremium/enableDisableEmailLimits";
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
operationVal: operationVal,
|
||||||
|
domainName: domainName
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers : {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data,config).then(ListInitialData, cantLoadInitialData);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialData(response) {
|
||||||
|
$scope.emailLimitsLoading = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
|
||||||
|
$timeout(function() { $window.location.reload(); }, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$timeout(function() { $window.location.reload(); }, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function cantLoadInitialData(response) {
|
||||||
|
$timeout(function() { $window.location.reload(); }, 0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// Email limits
|
||||||
|
$scope.changeLimitsForm = true;
|
||||||
|
$scope.changeLimitsFail = true;
|
||||||
|
$scope.changeLimitsSuccess = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
|
||||||
|
$scope.showLimitsForm = function () {
|
||||||
|
$scope.changeLimitsForm = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.hideLimitsForm = function () {
|
||||||
|
$scope.changeLimitsForm = true;
|
||||||
|
$scope.changeLimitsFail = true;
|
||||||
|
$scope.changeLimitsSuccess = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.changeDomainEmailLimitsIndividual = function () {
|
||||||
|
$scope.emailLimitsLoading = false;
|
||||||
|
|
||||||
|
url = "/emailPremium/changeDomainEmailLimitsIndividual";
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
emailAddress: globalEamilAddress,
|
||||||
|
monthlyLimit: $scope.monthlyLimitForm,
|
||||||
|
hourlyLimit: $scope.hourlyLimitForm
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers : {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data,config).then(ListInitialData, cantLoadInitialData);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialData(response) {
|
||||||
|
|
||||||
|
$scope.emailLimitsLoading = true;
|
||||||
|
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
|
||||||
|
$scope.changeLimitsForm = false;
|
||||||
|
$scope.changeLimitsFail = true;
|
||||||
|
$scope.changeLimitsSuccess = false;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
$scope.getEmailStats();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$scope.changeLimitsForm = false;
|
||||||
|
$scope.changeLimitsFail = false;
|
||||||
|
$scope.changeLimitsSuccess = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
$scope.errorMessage = response.data.error_message;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function cantLoadInitialData(response) {
|
||||||
|
$scope.emailLimitsLoading = true;
|
||||||
|
$scope.changeLimitsForm = false;
|
||||||
|
$scope.changeLimitsFail = true;
|
||||||
|
$scope.changeLimitsSuccess = true;
|
||||||
|
$scope.couldNotConnect = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Get email logs
|
||||||
|
|
||||||
|
$scope.getLogEntries = function(pageNumber) {
|
||||||
|
|
||||||
|
globalPageNumber = pageNumber;
|
||||||
|
$scope.emailLimitsLoading = false;
|
||||||
|
|
||||||
|
url = "/emailPremium/getEmailLogs";
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
page: pageNumber,
|
||||||
|
emailAddress: globalEamilAddress
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers : {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data,config).then(ListInitialData, cantLoadInitialData);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialData(response) {
|
||||||
|
|
||||||
|
$scope.emailLimitsLoading = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
|
||||||
|
$scope.logs = JSON.parse(response.data.data);
|
||||||
|
$scope.listFail = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$scope.listFail = false;
|
||||||
|
$scope.errorMessage = response.data.error_message;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function cantLoadInitialData(response) {
|
||||||
|
$scope.emailLimitsLoading = true;
|
||||||
|
$scope.listFail = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
$scope.getLogEntries(1);
|
||||||
|
|
||||||
|
|
||||||
|
$scope.flushLogs = function(emailAddress) {
|
||||||
|
|
||||||
|
$scope.emailLimitsLoading = false;
|
||||||
|
|
||||||
|
url = "/emailPremium/flushEmailLogs";
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
emailAddress: emailAddress
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers : {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data,config).then(ListInitialData, cantLoadInitialData);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialData(response) {
|
||||||
|
|
||||||
|
$scope.emailLimitsLoading = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
$scope.getLogEntries(1);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$scope.listFail = false;
|
||||||
|
$scope.errorMessage = response.data.error_message;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function cantLoadInitialData(response) {
|
||||||
|
$scope.emailLimitsLoading = true;
|
||||||
|
$scope.listFail = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Java script code for Email Page */
|
||||||
|
|
||||||
|
|
||||||
|
/* Java script code for SpamAssassin */
|
||||||
|
|
||||||
|
app.controller('SpamAssassin', function($scope, $http, $timeout, $window) {
|
||||||
|
|
||||||
|
$scope.SpamAssassinNotifyBox = true;
|
||||||
|
$scope.SpamAssassinInstallBox = true;
|
||||||
|
$scope.SpamAssassinLoading = true;
|
||||||
|
$scope.failedToStartInallation = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
$scope.SpamAssassinSuccessfullyInstalled = true;
|
||||||
|
$scope.installationFailed = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$scope.installSpamAssassin = function(){
|
||||||
|
|
||||||
|
$scope.SpamAssassinNotifyBox = true;
|
||||||
|
$scope.SpamAssassinInstallBox = true;
|
||||||
|
$scope.SpamAssassinLoading = false;
|
||||||
|
$scope.failedToStartInallation = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
$scope.SpamAssassinSuccessfullyInstalled = true;
|
||||||
|
$scope.installationFailed = true;
|
||||||
|
|
||||||
|
url = "/emailPremium/installSpamAssassin";
|
||||||
|
|
||||||
|
var data = {};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers : {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
|
if(response.data.status === 1){
|
||||||
|
|
||||||
|
$scope.SpamAssassinNotifyBox = true;
|
||||||
|
$scope.SpamAssassinInstallBox = false;
|
||||||
|
$scope.SpamAssassinLoading = false;
|
||||||
|
$scope.failedToStartInallation = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
$scope.SpamAssassinSuccessfullyInstalled = true;
|
||||||
|
$scope.installationFailed = true;
|
||||||
|
|
||||||
|
getRequestStatus();
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$scope.errorMessage = response.data.error_message;
|
||||||
|
|
||||||
|
$scope.SpamAssassinNotifyBox = false;
|
||||||
|
$scope.SpamAssassinInstallBox = true;
|
||||||
|
$scope.SpamAssassinLoading = true;
|
||||||
|
$scope.failedToStartInallation = false;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
$scope.SpamAssassinSuccessfullyInstalled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
|
||||||
|
$scope.SpamAssassinNotifyBox = false;
|
||||||
|
$scope.SpamAssassinInstallBox = false;
|
||||||
|
$scope.SpamAssassinLoading = true;
|
||||||
|
$scope.failedToStartInallation = true;
|
||||||
|
$scope.couldNotConnect = false;
|
||||||
|
$scope.SpamAssassinSuccessfullyInstalled = true;
|
||||||
|
$scope.installationFailed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
function getRequestStatus(){
|
||||||
|
|
||||||
|
$scope.SpamAssassinNotifyBox = true;
|
||||||
|
$scope.SpamAssassinInstallBox = false;
|
||||||
|
$scope.SpamAssassinLoading = false;
|
||||||
|
$scope.failedToStartInallation = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
$scope.SpamAssassinSuccessfullyInstalled = true;
|
||||||
|
$scope.installationFailed = true;
|
||||||
|
|
||||||
|
url = "/emailPremium/installStatusSpamAssassin";
|
||||||
|
|
||||||
|
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.SpamAssassinNotifyBox = true;
|
||||||
|
$scope.SpamAssassinInstallBox = false;
|
||||||
|
$scope.SpamAssassinLoading = false;
|
||||||
|
$scope.failedToStartInallation = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
$scope.SpamAssassinSuccessfullyInstalled = true;
|
||||||
|
$scope.installationFailed = true;
|
||||||
|
|
||||||
|
$scope.requestData = response.data.requestStatus;
|
||||||
|
$timeout(getRequestStatus,1000);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
// Notifications
|
||||||
|
$timeout.cancel();
|
||||||
|
$scope.SpamAssassinNotifyBox = false;
|
||||||
|
$scope.SpamAssassinInstallBox = false;
|
||||||
|
$scope.SpamAssassinLoading = true;
|
||||||
|
$scope.failedToStartInallation = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
|
||||||
|
$scope.requestData = response.data.requestStatus;
|
||||||
|
|
||||||
|
if(response.data.installed === 0) {
|
||||||
|
$scope.installationFailed = false;
|
||||||
|
$scope.errorMessage = response.data.error_message;
|
||||||
|
}else{
|
||||||
|
$scope.SpamAssassinSuccessfullyInstalled = false;
|
||||||
|
$timeout(function() { $window.location.reload(); }, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
|
||||||
|
$scope.SpamAssassinNotifyBox = false;
|
||||||
|
$scope.SpamAssassinInstallBox = false;
|
||||||
|
$scope.SpamAssassinLoading = true;
|
||||||
|
$scope.failedToStartInallation = true;
|
||||||
|
$scope.couldNotConnect = false;
|
||||||
|
$scope.SpamAssassinSuccessfullyInstalled = true;
|
||||||
|
$scope.installationFailed = true;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
///// SpamAssassin configs
|
||||||
|
|
||||||
|
var report_safe = false;
|
||||||
|
|
||||||
|
|
||||||
|
$('#report_safe').change(function() {
|
||||||
|
report_safe = $(this).prop('checked');
|
||||||
|
});
|
||||||
|
|
||||||
|
fetchSpamAssassinSettings();
|
||||||
|
function fetchSpamAssassinSettings(){
|
||||||
|
|
||||||
|
$scope.SpamAssassinLoading = false;
|
||||||
|
|
||||||
|
$('#report_safe').bootstrapToggle('off');
|
||||||
|
|
||||||
|
url = "/emailPremium/fetchSpamAssassinSettings";
|
||||||
|
|
||||||
|
var data = {};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers : {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
$scope.SpamAssassinLoading = true;
|
||||||
|
|
||||||
|
if(response.data.fetchStatus === 1){
|
||||||
|
|
||||||
|
if(response.data.installed === 1) {
|
||||||
|
|
||||||
|
if (response.data.report_safe === 1) {
|
||||||
|
$('#report_safe').bootstrapToggle('on');
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.required_hits = response.data.required_hits;
|
||||||
|
$scope.rewrite_header = response.data.rewrite_header;
|
||||||
|
$scope.required_score = response.data.required_score;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
$scope.SpamAssassinLoading = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////
|
||||||
|
|
||||||
|
/// Save SpamAssassin Changes
|
||||||
|
|
||||||
|
$scope.failedToSave = true;
|
||||||
|
$scope.successfullySaved = true;
|
||||||
|
|
||||||
|
$scope.saveSpamAssassinConfigurations = function () {
|
||||||
|
|
||||||
|
$scope.failedToSave = true;
|
||||||
|
$scope.successfullySaved = true;
|
||||||
|
$scope.SpamAssassinLoading = false;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
|
||||||
|
|
||||||
|
url = "/emailPremium/saveSpamAssassinConfigurations";
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
report_safe:report_safe,
|
||||||
|
required_hits:$scope.required_hits,
|
||||||
|
rewrite_header:$scope.rewrite_header,
|
||||||
|
required_score:$scope.required_score
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers : {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
|
if(response.data.saveStatus === 1){
|
||||||
|
|
||||||
|
$scope.failedToSave = true;
|
||||||
|
$scope.successfullySaved = false;
|
||||||
|
$scope.SpamAssassinLoading = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$scope.errorMessage = response.data.error_message;
|
||||||
|
|
||||||
|
$scope.failedToSave = false;
|
||||||
|
$scope.successfullySaved = true;
|
||||||
|
$scope.SpamAssassinLoading = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
$scope.failedToSave = true;
|
||||||
|
$scope.successfullySaved = false;
|
||||||
|
$scope.SpamAssassinLoading = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user