mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-14 01:06:09 +01:00
improvments to email verification
This commit is contained in:
@@ -237,10 +237,8 @@ app.controller('backupWebsiteControl', function ($scope, $http, $timeout) {
|
|||||||
|
|
||||||
///** Backup site ends **///
|
///** Backup site ends **///
|
||||||
|
|
||||||
|
|
||||||
///** Restore site ***//
|
///** Restore site ***//
|
||||||
|
|
||||||
|
|
||||||
app.controller('restoreWebsiteControl', function ($scope, $http, $timeout) {
|
app.controller('restoreWebsiteControl', function ($scope, $http, $timeout) {
|
||||||
|
|
||||||
$scope.restoreLoading = true;
|
$scope.restoreLoading = true;
|
||||||
@@ -415,13 +413,10 @@ app.controller('restoreWebsiteControl', function ($scope, $http, $timeout) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//*** Restore site ends here ***///
|
//*** Restore site ends here ***///
|
||||||
|
|
||||||
|
|
||||||
///** Backup Destination ***//
|
///** Backup Destination ***//
|
||||||
|
|
||||||
|
|
||||||
app.controller('backupDestinations', function ($scope, $http, $timeout) {
|
app.controller('backupDestinations', function ($scope, $http, $timeout) {
|
||||||
|
|
||||||
$scope.destinationLoading = true;
|
$scope.destinationLoading = true;
|
||||||
@@ -666,13 +661,10 @@ app.controller('backupDestinations', function ($scope, $http, $timeout) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//*** Backup destination ***///
|
//*** Backup destination ***///
|
||||||
|
|
||||||
|
|
||||||
///** Schedule Backup ***//
|
///** Schedule Backup ***//
|
||||||
|
|
||||||
|
|
||||||
app.controller('scheduleBackup', function ($scope, $http, $timeout) {
|
app.controller('scheduleBackup', function ($scope, $http, $timeout) {
|
||||||
|
|
||||||
$scope.scheduleBackupLoading = true;
|
$scope.scheduleBackupLoading = true;
|
||||||
@@ -951,10 +943,8 @@ app.controller('scheduleBackup', function ($scope, $http, $timeout) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//*** Schedule Backup ***///
|
//*** Schedule Backup ***///
|
||||||
|
|
||||||
|
|
||||||
//*** Remote Backup site ****//
|
//*** Remote Backup site ****//
|
||||||
app.controller('remoteBackupControl', function ($scope, $http, $timeout) {
|
app.controller('remoteBackupControl', function ($scope, $http, $timeout) {
|
||||||
|
|
||||||
@@ -1543,7 +1533,6 @@ app.controller('remoteBackupControl', function ($scope, $http, $timeout) {
|
|||||||
|
|
||||||
///** Backup site ends **///
|
///** Backup site ends **///
|
||||||
|
|
||||||
|
|
||||||
//*** Remote Backup site ****//
|
//*** Remote Backup site ****//
|
||||||
app.controller('backupLogsScheduled', function ($scope, $http, $timeout) {
|
app.controller('backupLogsScheduled', function ($scope, $http, $timeout) {
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import time
|
|||||||
import csv
|
import csv
|
||||||
import re
|
import re
|
||||||
import plogical.CyberCPLogFileWriter as logging
|
import plogical.CyberCPLogFileWriter as logging
|
||||||
from .models import EmailMarketing, EmailLists, EmailsInList, EmailTemplate, EmailJobs, SMTPHosts
|
from .models import EmailMarketing, EmailLists, EmailsInList, EmailTemplate, EmailJobs, SMTPHosts, ValidationLog
|
||||||
|
from plogical.backupSchedule import backupSchedule
|
||||||
from websiteFunctions.models import Websites
|
from websiteFunctions.models import Websites
|
||||||
import threading as multi
|
import threading as multi
|
||||||
import socket, smtplib
|
import socket, smtplib
|
||||||
@@ -130,7 +131,6 @@ class emailMarketing(multi.Thread):
|
|||||||
verificationList = EmailLists.objects.get(listName=self.extraArgs['listName'])
|
verificationList = EmailLists.objects.get(listName=self.extraArgs['listName'])
|
||||||
domain = verificationList.owner.domain
|
domain = verificationList.owner.domain
|
||||||
|
|
||||||
|
|
||||||
if not os.path.exists('/home/cyberpanel/' + domain):
|
if not os.path.exists('/home/cyberpanel/' + domain):
|
||||||
os.mkdir('/home/cyberpanel/' + domain)
|
os.mkdir('/home/cyberpanel/' + domain)
|
||||||
|
|
||||||
@@ -138,12 +138,13 @@ class emailMarketing(multi.Thread):
|
|||||||
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, 'Starting verification job..')
|
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, 'Starting verification job..')
|
||||||
|
|
||||||
counter = 1
|
counter = 1
|
||||||
|
counterGlobal = 0
|
||||||
|
|
||||||
allEmailsInList = verificationList.emailsinlist_set.all()
|
allEmailsInList = verificationList.emailsinlist_set.all()
|
||||||
|
|
||||||
configureVerifyPath = '/home/cyberpanel/configureVerify'
|
configureVerifyPath = '/home/cyberpanel/configureVerify'
|
||||||
finalPath = '%s/%s' % (configureVerifyPath, domain)
|
finalPath = '%s/%s' % (configureVerifyPath, domain)
|
||||||
|
|
||||||
counterGlobal = 0
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
if os.path.exists(finalPath):
|
if os.path.exists(finalPath):
|
||||||
@@ -151,33 +152,43 @@ class emailMarketing(multi.Thread):
|
|||||||
|
|
||||||
self.currentIP = ''
|
self.currentIP = ''
|
||||||
|
|
||||||
|
ValidationLog(owner=verificationList, status=backupSchedule.INFO, message='Starting email verification..').save()
|
||||||
|
|
||||||
for items in allEmailsInList:
|
for items in allEmailsInList:
|
||||||
if items.verificationStatus != 'Verified':
|
if items.verificationStatus != 'Verified':
|
||||||
try:
|
try:
|
||||||
email = items.email
|
email = items.email
|
||||||
|
self.currentEmail = email
|
||||||
domainName = email.split('@')[1]
|
domainName = email.split('@')[1]
|
||||||
records = DNS.dnslookup(domainName, 'MX')
|
records = DNS.dnslookup(domainName, 'MX')
|
||||||
|
|
||||||
|
ValidationLog(owner=verificationList, status=backupSchedule.INFO,
|
||||||
|
message='Trying to verify %s ..' % (email)).save()
|
||||||
|
|
||||||
for mxRecord in records:
|
for mxRecord in records:
|
||||||
# Get local server hostname
|
# Get local server hostname
|
||||||
host = socket.gethostname()
|
host = socket.gethostname()
|
||||||
|
|
||||||
|
## Only fetching smtp object
|
||||||
|
|
||||||
if os.path.exists(finalPath):
|
if os.path.exists(finalPath):
|
||||||
try:
|
try:
|
||||||
logging.CyberCPLogFileWriter.writeToFile('Checking if delay is enabled for verification..')
|
ValidationLog(owner=verificationList, status=backupSchedule.INFO,
|
||||||
|
message='Checking if delay is enabled for verification..').save()
|
||||||
delay = self.delayData['delay']
|
delay = self.delayData['delay']
|
||||||
if delay == 'Enable':
|
if delay == 'Enable':
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
ValidationLog(owner=verificationList, status=backupSchedule.INFO,
|
||||||
'It seems delay is enabled...')
|
message='It seems delay is enabled...').save()
|
||||||
if counterGlobal == int(self.delayData['delayAfter']):
|
if counterGlobal == int(self.delayData['delayAfter']):
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
ValidationLog(owner=verificationList, status=backupSchedule.INFO,
|
||||||
'Sleeping for %s seconds...' % (self.delayData['delayTime']))
|
message='Sleeping for %s seconds...' % (self.delayData['delayTime'])).save()
|
||||||
|
|
||||||
time.sleep(int(self.delayData['delayTime']))
|
time.sleep(int(self.delayData['delayTime']))
|
||||||
counterGlobal = 0
|
counterGlobal = 0
|
||||||
self.currentIP = self.findNextIP()
|
self.currentIP = self.findNextIP()
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
ValidationLog(owner=verificationList, status=backupSchedule.INFO,
|
||||||
'IP in use: %s.' % (str(self.currentIP)))
|
message='IP being used for validation until next sleep: %s.' % (str(self.currentIP))).save()
|
||||||
|
|
||||||
if self.currentIP == None:
|
if self.currentIP == None:
|
||||||
server = smtplib.SMTP()
|
server = smtplib.SMTP()
|
||||||
@@ -188,8 +199,9 @@ class emailMarketing(multi.Thread):
|
|||||||
if self.currentIP == '':
|
if self.currentIP == '':
|
||||||
self.currentIP = self.findNextIP()
|
self.currentIP = self.findNextIP()
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
ValidationLog(owner=verificationList, status=backupSchedule.INFO,
|
||||||
'IP in use: %s.' % (str(self.currentIP)))
|
message='IP being used for validation until next sleep: %s.' % (
|
||||||
|
str(self.currentIP))).save()
|
||||||
|
|
||||||
if self.currentIP == None:
|
if self.currentIP == None:
|
||||||
server = smtplib.SMTP()
|
server = smtplib.SMTP()
|
||||||
@@ -198,16 +210,23 @@ class emailMarketing(multi.Thread):
|
|||||||
else:
|
else:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
'Delay not configured..')
|
'Delay not configured..')
|
||||||
|
|
||||||
|
ValidationLog(owner=verificationList, status=backupSchedule.INFO,
|
||||||
|
message='Delay not configured..').save()
|
||||||
|
|
||||||
server = smtplib.SMTP()
|
server = smtplib.SMTP()
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
|
||||||
'Delay not configured.. Error: %s' % (str(msg)))
|
ValidationLog(owner=verificationList, status=backupSchedule.ERROR,
|
||||||
|
message='Delay not configured. Error message: %s' % (str(msg))).save()
|
||||||
|
|
||||||
server = smtplib.SMTP()
|
server = smtplib.SMTP()
|
||||||
else:
|
else:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
ValidationLog(owner=verificationList, status=backupSchedule.INFO,
|
||||||
'Delay not configured..')
|
message='Delay not configured..').save()
|
||||||
server = smtplib.SMTP()
|
server = smtplib.SMTP()
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
server.set_debuglevel(0)
|
server.set_debuglevel(0)
|
||||||
|
|
||||||
@@ -220,12 +239,15 @@ class emailMarketing(multi.Thread):
|
|||||||
|
|
||||||
# Assume 250 as Success
|
# Assume 250 as Success
|
||||||
if code == 250:
|
if code == 250:
|
||||||
|
ValidationLog(owner=verificationList, status=backupSchedule.INFO,
|
||||||
|
message='Verified %s successfully.' % (email)).save()
|
||||||
items.verificationStatus = 'Verified'
|
items.verificationStatus = 'Verified'
|
||||||
items.save()
|
items.save()
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
ValidationLog(owner=verificationList, status=backupSchedule.ERROR,
|
||||||
|
message='Failed to verify %s. Error message %s' % (email, message.decode())).save()
|
||||||
items.verificationStatus = 'Verification Failed'
|
items.verificationStatus = 'Verification Failed'
|
||||||
logging.CyberCPLogFileWriter.writeToFile(email + " verification failed with error: " + message.decode())
|
|
||||||
items.save()
|
items.save()
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, str(counter) + ' emails verified so far..')
|
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, str(counter) + ' emails verified so far..')
|
||||||
@@ -235,17 +257,24 @@ class emailMarketing(multi.Thread):
|
|||||||
items.save()
|
items.save()
|
||||||
counter = counter + 1
|
counter = counter + 1
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
|
ValidationLog(owner=verificationList, status=backupSchedule.ERROR,
|
||||||
|
message='Failed to verify %s. Error message %s' % (
|
||||||
|
self.currentEmail , str(msg))).save()
|
||||||
|
|
||||||
|
|
||||||
counterGlobal = counterGlobal + 1
|
counterGlobal = counterGlobal + 1
|
||||||
|
|
||||||
|
verificationList.notVerified = verificationList.emailsinlist_set.filter(verificationStatus='Verification Failed').count()
|
||||||
|
verificationList.verified = verificationList.emailsinlist_set.filter(verificationStatus='Verified').count()
|
||||||
|
verificationList.save()
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, str(counter) + ' emails successfully verified. [200]')
|
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, str(counter) + ' emails successfully verified. [200]')
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
verificationList = EmailLists.objects.get(listName=self.extraArgs['listName'])
|
verificationList = EmailLists.objects.get(listName=self.extraArgs['listName'])
|
||||||
domain = verificationList.owner.domain
|
domain = verificationList.owner.domain
|
||||||
tempStatusPath = '/home/cyberpanel/' + domain + "/" + self.extraArgs['listName']
|
tempStatusPath = '/home/cyberpanel/' + domain + "/" + self.extraArgs['listName']
|
||||||
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, str(msg) +'. [404]')
|
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, str(msg) +'. [404]')
|
||||||
logging.CyberCPLogFileWriter.writeToFile('your error')
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def startEmailJob(self):
|
def startEmailJob(self):
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import smtplib
|
|||||||
from .models import SMTPHosts, EmailTemplate
|
from .models import SMTPHosts, EmailTemplate
|
||||||
from loginSystem.models import Administrator
|
from loginSystem.models import Administrator
|
||||||
from .emACL import emACL
|
from .emACL import emACL
|
||||||
|
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||||
|
|
||||||
class EmailMarketingManager:
|
class EmailMarketingManager:
|
||||||
|
|
||||||
@@ -199,6 +200,74 @@ class EmailMarketingManager:
|
|||||||
except KeyError as msg:
|
except KeyError as msg:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
def fetchVerifyLogs(self):
|
||||||
|
try:
|
||||||
|
|
||||||
|
userID = self.request.session['userID']
|
||||||
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
|
data = json.loads(self.request.body)
|
||||||
|
|
||||||
|
self.listName = data['listName']
|
||||||
|
recordsToShow = int(data['recordsToShow'])
|
||||||
|
page = int(str(data['page']).strip('\n'))
|
||||||
|
|
||||||
|
emailList = EmailLists.objects.get(listName=self.listName)
|
||||||
|
|
||||||
|
if ACLManager.checkOwnership(emailList.owner.domain, admin, currentACL) == 1:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
return ACLManager.loadErrorJson('status', 0)
|
||||||
|
|
||||||
|
logs = emailList.validationlog_set.all()
|
||||||
|
|
||||||
|
from s3Backups.s3Backups import S3Backups
|
||||||
|
|
||||||
|
pagination = S3Backups.getPagination(len(logs), recordsToShow)
|
||||||
|
endPageNumber, finalPageNumber = S3Backups.recordsPointer(page, recordsToShow)
|
||||||
|
finalLogs = logs[finalPageNumber:endPageNumber]
|
||||||
|
|
||||||
|
json_data = "["
|
||||||
|
checker = 0
|
||||||
|
counter = 0
|
||||||
|
|
||||||
|
from plogical.backupSchedule import backupSchedule
|
||||||
|
|
||||||
|
for log in finalLogs:
|
||||||
|
if log.status == backupSchedule.INFO:
|
||||||
|
status = 'INFO'
|
||||||
|
else:
|
||||||
|
status = 'ERROR'
|
||||||
|
|
||||||
|
dic = {
|
||||||
|
'status': status, "message": log.message
|
||||||
|
}
|
||||||
|
|
||||||
|
if checker == 0:
|
||||||
|
json_data = json_data + json.dumps(dic)
|
||||||
|
checker = 1
|
||||||
|
else:
|
||||||
|
json_data = json_data + ',' + json.dumps(dic)
|
||||||
|
|
||||||
|
counter = counter + 1
|
||||||
|
|
||||||
|
json_data = json_data + ']'
|
||||||
|
|
||||||
|
totalEmail = emailList.emailsinlist_set.all().count()
|
||||||
|
verified = emailList.verified
|
||||||
|
notVerified = emailList.notVerified
|
||||||
|
|
||||||
|
data_ret = {'status': 1, 'logs': json_data, 'pagination': pagination, 'totalEmails': totalEmail, 'verified': verified, 'notVerified': notVerified}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
|
except BaseException as msg:
|
||||||
|
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
def saveConfigureVerify(self):
|
def saveConfigureVerify(self):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -791,7 +860,6 @@ class EmailMarketingManager:
|
|||||||
final_json = json.dumps(final_dic)
|
final_json = json.dumps(final_dic)
|
||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
|
|
||||||
def remove(self, listName, emailAddress):
|
def remove(self, listName, emailAddress):
|
||||||
try:
|
try:
|
||||||
eList = EmailLists.objects.get(listName=listName)
|
eList = EmailLists.objects.get(listName=listName)
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ class EmailLists(models.Model):
|
|||||||
owner = models.ForeignKey(Websites, on_delete=models.PROTECT)
|
owner = models.ForeignKey(Websites, on_delete=models.PROTECT)
|
||||||
listName = models.CharField(max_length=50, unique=True)
|
listName = models.CharField(max_length=50, unique=True)
|
||||||
dateCreated = models.CharField(max_length=200)
|
dateCreated = models.CharField(max_length=200)
|
||||||
|
verified = models.IntegerField(default=0)
|
||||||
|
notVerified = models.IntegerField(default=0)
|
||||||
|
|
||||||
class EmailsInList(models.Model):
|
class EmailsInList(models.Model):
|
||||||
owner = models.ForeignKey(EmailLists, on_delete=models.CASCADE)
|
owner = models.ForeignKey(EmailLists, on_delete=models.CASCADE)
|
||||||
@@ -31,7 +32,6 @@ class SMTPHosts(models.Model):
|
|||||||
userName = models.CharField(max_length=50)
|
userName = models.CharField(max_length=50)
|
||||||
password = models.CharField(max_length=50)
|
password = models.CharField(max_length=50)
|
||||||
|
|
||||||
|
|
||||||
class EmailTemplate(models.Model):
|
class EmailTemplate(models.Model):
|
||||||
owner = models.ForeignKey(Administrator, on_delete=models.CASCADE)
|
owner = models.ForeignKey(Administrator, on_delete=models.CASCADE)
|
||||||
name = models.CharField(unique=True, max_length=100)
|
name = models.CharField(unique=True, max_length=100)
|
||||||
@@ -49,3 +49,8 @@ class EmailJobs(models.Model):
|
|||||||
sent = models.IntegerField()
|
sent = models.IntegerField()
|
||||||
failed = models.IntegerField()
|
failed = models.IntegerField()
|
||||||
|
|
||||||
|
class ValidationLog(models.Model):
|
||||||
|
owner = models.ForeignKey(EmailLists, on_delete=models.CASCADE)
|
||||||
|
status = models.IntegerField()
|
||||||
|
message = models.TextField()
|
||||||
|
|
||||||
|
|||||||
@@ -774,6 +774,58 @@ app.controller('manageEmailLists', function ($scope, $http, $timeout) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$scope.currentPageLogs = 1;
|
||||||
|
$scope.recordsToShowLogs = 10;
|
||||||
|
|
||||||
|
$scope.fetchLogs = function () {
|
||||||
|
|
||||||
|
$scope.cyberPanelLoading = false;
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
listName: $scope.listName,
|
||||||
|
page: $scope.currentPageLogs,
|
||||||
|
recordsToShow: $scope.recordsToShowLogs
|
||||||
|
};
|
||||||
|
|
||||||
|
url = "/emailMarketing/fetchVerifyLogs";
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
|
||||||
|
|
||||||
|
function ListInitialData(response) {
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
$scope.recordsLogs = JSON.parse(response.data.logs);
|
||||||
|
$scope.paginationLogs = response.data.pagination;
|
||||||
|
$scope.totalEmails = response.data.totalEmails;
|
||||||
|
$scope.verified = response.data.verified;
|
||||||
|
$scope.notVerified = response.data.notVerified;
|
||||||
|
} else {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Error!',
|
||||||
|
text: response.data.error_message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function cantLoadInitialData(response) {
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: 'Could not connect to server, please refresh this page',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.controller('manageSMTPHostsCTRL', function ($scope, $http) {
|
app.controller('manageSMTPHostsCTRL', function ($scope, $http) {
|
||||||
|
|||||||
@@ -64,14 +64,14 @@
|
|||||||
<div ng-hide="ipv4Hidden" class="form-group">
|
<div ng-hide="ipv4Hidden" class="form-group">
|
||||||
<label class="col-sm-3 control-label">{% trans "IPv4" %}</label>
|
<label class="col-sm-3 control-label">{% trans "IPv4" %}</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<input placeholder="{% trans 'Enter IPv4(s) to be used separate with commas, subnet is also allowed.' %}" type="text" class="form-control" ng-model="ipv4" required>
|
<input placeholder="{% trans 'Enter IPv4(s) to be used separate with commas.' %}" type="text" class="form-control" ng-model="ipv4" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-hide="ipv6Hidden" class="form-group">
|
<div ng-hide="ipv6Hidden" class="form-group">
|
||||||
<label class="col-sm-3 control-label">{% trans "IPv6" %}</label>
|
<label class="col-sm-3 control-label">{% trans "IPv6" %}</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<input placeholder="{% trans 'Enter IPv6(s) to be used separate with commas, subnet is also allowed.' %}" type="text" class="form-control" ng-model="ipv6" required>
|
<input placeholder="{% trans 'Enter IPv6(s) to be used separate with commas.' %}" type="text" class="form-control" ng-model="ipv6" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -37,48 +37,155 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-hide="currentRecords" class="form-group">
|
<div ng-hide="currentRecords" class="form-group">
|
||||||
<div class="col-sm-3">
|
<div class="row">
|
||||||
<button data-toggle="modal" data-target="#deleteList"
|
<div class="col-sm-2">
|
||||||
class="btn ra-100 btn-danger">{% trans 'Delete This List' %}</button>
|
<button data-toggle="modal" data-target="#deleteList"
|
||||||
<!--- Delete Pool --->
|
class="btn ra-100 btn-danger">{% trans 'Delete This List' %}</button>
|
||||||
<div class="modal fade" id="deleteList" tabindex="-1" role="dialog"
|
<!--- Delete Pool --->
|
||||||
aria-labelledby="myModalLabel" aria-hidden="true">
|
<div class="modal fade" id="deleteList" tabindex="-1" role="dialog"
|
||||||
<div class="modal-dialog">
|
aria-labelledby="myModalLabel" aria-hidden="true">
|
||||||
<div class="modal-content">
|
<div class="modal-dialog">
|
||||||
<div class="modal-header">
|
<div class="modal-content">
|
||||||
<button type="button" class="close" data-dismiss="modal"
|
<div class="modal-header">
|
||||||
aria-hidden="true">×
|
<button type="button" class="close" data-dismiss="modal"
|
||||||
</button>
|
aria-hidden="true">×
|
||||||
<h4 class="modal-title">{% trans "You are doing to delete this list.." %}
|
</button>
|
||||||
<img ng-hide="cyberPanelLoading"
|
<h4 class="modal-title">{% trans "You are doing to delete this list.." %}
|
||||||
src="{% static 'images/loading.gif' %}"></h4>
|
<img ng-hide="cyberPanelLoading"
|
||||||
</div>
|
src="{% static 'images/loading.gif' %}"></h4>
|
||||||
<div class="modal-body">
|
</div>
|
||||||
<p>{% trans 'Are you sure?' %}</p>
|
<div class="modal-body">
|
||||||
</div>
|
<p>{% trans 'Are you sure?' %}</p>
|
||||||
<div class="modal-footer">
|
</div>
|
||||||
<button type="button" class="btn btn-default"
|
<div class="modal-footer">
|
||||||
data-dismiss="modal">{% trans 'Close' %}</button>
|
<button type="button" class="btn btn-default"
|
||||||
<button data-dismiss="modal" ng-click="deleteList()" type="button"
|
data-dismiss="modal">{% trans 'Close' %}</button>
|
||||||
class="btn btn-primary">{% trans 'Confirm' %}</button>
|
<button data-dismiss="modal" ng-click="deleteList()" type="button"
|
||||||
|
class="btn btn-primary">{% trans 'Confirm' %}</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!--- Delete Pool --->
|
||||||
</div>
|
</div>
|
||||||
<!--- Delete Pool --->
|
<div class="col-sm-2">
|
||||||
</div>
|
<button ng-disabled="verificationButton" ng-click="startVerification()"
|
||||||
<div class="col-sm-3">
|
class="btn ra-100 btn-blue-alt">{% trans 'Verify This List' %}</button>
|
||||||
<button ng-disabled="verificationButton" ng-click="startVerification()"
|
</div>
|
||||||
class="btn ra-100 btn-blue-alt">{% trans 'Verify This List' %}</button>
|
<div class="col-sm-2">
|
||||||
</div>
|
<a target="_blank" href="/emailMarketing/{{ domain }}/configureVerify">
|
||||||
<a target="_blank" href="/emailMarketing/{{ domain }}/configureVerify">
|
<button class="btn ra-100 btn-blue-alt">{% trans 'Configure Verification' %}</button>
|
||||||
<div class="col-sm-3">
|
</a>
|
||||||
<button class="btn ra-100 btn-blue-alt">{% trans 'Configure Verification Settings' %}</button>
|
</div>
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<button ng-click="fetchLogs()" data-toggle="modal" data-target="#verificationLogs"
|
||||||
|
class="btn ra-100 btn-blue-alt">{% trans 'Verfications Logs' %}</button>
|
||||||
|
<!--- Delete Pool --->
|
||||||
|
<div class="modal fade" id="verificationLogs" tabindex="-1" role="dialog"
|
||||||
|
aria-labelledby="myModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal"
|
||||||
|
aria-hidden="true">×
|
||||||
|
</button>
|
||||||
|
<h4 class="modal-title">{% trans "Verification Logs" %}
|
||||||
|
<img ng-hide="cyberPanelLoading"
|
||||||
|
src="{% static 'images/loading.gif' %}"></h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<!------ List of records --------------->
|
||||||
|
|
||||||
|
<div ng-hide="currentRecords" class="form-group">
|
||||||
|
|
||||||
|
<table style="margin: 0px; padding-bottom: 2%" class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{% trans "Total Emails" %}</th>
|
||||||
|
<th>{% trans "Verified" %}</th>
|
||||||
|
<th>{% trans "Not-Verified" %}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>{$ totalEmails $}</td>
|
||||||
|
<td>{$ verified $}</td>
|
||||||
|
<td>{$ notVerified $}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<input placeholder="Search Logs..." name="dom" type="text"
|
||||||
|
class="form-control" ng-model="searchLogs"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 1%;" class="col-sm-2">
|
||||||
|
<select ng-change="fetchLogs()" ng-model="recordsToShowLogs"
|
||||||
|
class="form-control">
|
||||||
|
<option>10</option>
|
||||||
|
<option>50</option>
|
||||||
|
<option>100</option>
|
||||||
|
<option>500</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-12">
|
||||||
|
|
||||||
|
<table style="margin: 0px" class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{% trans "Status" %}</th>
|
||||||
|
<th>{% trans "Message" %}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr ng-repeat="record in recordsLogs | filter:searchLogs">
|
||||||
|
<td ng-bind="record.status"></td>
|
||||||
|
<td ng-bind="record.message"></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div style="margin-top: 2%" class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<select ng-model="currentPageLogs"
|
||||||
|
class="form-control"
|
||||||
|
ng-change="fetchLogs()">
|
||||||
|
<option ng-repeat="page in paginationLogs">
|
||||||
|
{$ $index + 1
|
||||||
|
$}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> <!-- end row -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!------ List of records --------------->
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default"
|
||||||
|
data-dismiss="modal">{% trans 'Close' %}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--- Delete Pool --->
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<button ng-click="showAddEmails()"
|
||||||
|
class="btn ra-100 btn-blue-alt">{% trans 'Add More Emails' %}</button>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
|
||||||
<div class="col-sm-3">
|
|
||||||
<button ng-click="showAddEmails()"
|
|
||||||
class="btn ra-100 btn-blue-alt">{% trans 'Add More Emails' %}</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ urlpatterns = [
|
|||||||
url(r'^fetchUsers$', views.fetchUsers, name='fetchUsers'),
|
url(r'^fetchUsers$', views.fetchUsers, name='fetchUsers'),
|
||||||
url(r'^enableDisableMarketing$', views.enableDisableMarketing, name='enableDisableMarketing'),
|
url(r'^enableDisableMarketing$', views.enableDisableMarketing, name='enableDisableMarketing'),
|
||||||
url(r'^saveConfigureVerify$', views.saveConfigureVerify, name='saveConfigureVerify'),
|
url(r'^saveConfigureVerify$', views.saveConfigureVerify, name='saveConfigureVerify'),
|
||||||
|
url(r'^fetchVerifyLogs$', views.fetchVerifyLogs, name='fetchVerifyLogs'),
|
||||||
url(r'^(?P<domain>(.*))/emailLists$', views.createEmailList, name='createEmailList'),
|
url(r'^(?P<domain>(.*))/emailLists$', views.createEmailList, name='createEmailList'),
|
||||||
url(r'^submitEmailList$', views.submitEmailList, name='submitEmailList'),
|
url(r'^submitEmailList$', views.submitEmailList, name='submitEmailList'),
|
||||||
url(r'^(?P<domain>(.*))/manageLists$', views.manageLists, name='manageLists'),
|
url(r'^(?P<domain>(.*))/manageLists$', views.manageLists, name='manageLists'),
|
||||||
|
|||||||
@@ -70,6 +70,14 @@ def saveConfigureVerify(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
def fetchVerifyLogs(request):
|
||||||
|
try:
|
||||||
|
userID = request.session['userID']
|
||||||
|
emm = EmailMarketingManager(request)
|
||||||
|
return emm.fetchVerifyLogs()
|
||||||
|
except KeyError:
|
||||||
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
def fetchEmails(request):
|
def fetchEmails(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
|
|||||||
@@ -237,10 +237,8 @@ app.controller('backupWebsiteControl', function ($scope, $http, $timeout) {
|
|||||||
|
|
||||||
///** Backup site ends **///
|
///** Backup site ends **///
|
||||||
|
|
||||||
|
|
||||||
///** Restore site ***//
|
///** Restore site ***//
|
||||||
|
|
||||||
|
|
||||||
app.controller('restoreWebsiteControl', function ($scope, $http, $timeout) {
|
app.controller('restoreWebsiteControl', function ($scope, $http, $timeout) {
|
||||||
|
|
||||||
$scope.restoreLoading = true;
|
$scope.restoreLoading = true;
|
||||||
@@ -415,13 +413,10 @@ app.controller('restoreWebsiteControl', function ($scope, $http, $timeout) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//*** Restore site ends here ***///
|
//*** Restore site ends here ***///
|
||||||
|
|
||||||
|
|
||||||
///** Backup Destination ***//
|
///** Backup Destination ***//
|
||||||
|
|
||||||
|
|
||||||
app.controller('backupDestinations', function ($scope, $http, $timeout) {
|
app.controller('backupDestinations', function ($scope, $http, $timeout) {
|
||||||
|
|
||||||
$scope.destinationLoading = true;
|
$scope.destinationLoading = true;
|
||||||
@@ -666,13 +661,10 @@ app.controller('backupDestinations', function ($scope, $http, $timeout) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//*** Backup destination ***///
|
//*** Backup destination ***///
|
||||||
|
|
||||||
|
|
||||||
///** Schedule Backup ***//
|
///** Schedule Backup ***//
|
||||||
|
|
||||||
|
|
||||||
app.controller('scheduleBackup', function ($scope, $http, $timeout) {
|
app.controller('scheduleBackup', function ($scope, $http, $timeout) {
|
||||||
|
|
||||||
$scope.scheduleBackupLoading = true;
|
$scope.scheduleBackupLoading = true;
|
||||||
@@ -951,10 +943,8 @@ app.controller('scheduleBackup', function ($scope, $http, $timeout) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//*** Schedule Backup ***///
|
//*** Schedule Backup ***///
|
||||||
|
|
||||||
|
|
||||||
//*** Remote Backup site ****//
|
//*** Remote Backup site ****//
|
||||||
app.controller('remoteBackupControl', function ($scope, $http, $timeout) {
|
app.controller('remoteBackupControl', function ($scope, $http, $timeout) {
|
||||||
|
|
||||||
@@ -1543,7 +1533,6 @@ app.controller('remoteBackupControl', function ($scope, $http, $timeout) {
|
|||||||
|
|
||||||
///** Backup site ends **///
|
///** Backup site ends **///
|
||||||
|
|
||||||
|
|
||||||
//*** Remote Backup site ****//
|
//*** Remote Backup site ****//
|
||||||
app.controller('backupLogsScheduled', function ($scope, $http, $timeout) {
|
app.controller('backupLogsScheduled', function ($scope, $http, $timeout) {
|
||||||
|
|
||||||
|
|||||||
@@ -774,6 +774,58 @@ app.controller('manageEmailLists', function ($scope, $http, $timeout) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$scope.currentPageLogs = 1;
|
||||||
|
$scope.recordsToShowLogs = 10;
|
||||||
|
|
||||||
|
$scope.fetchLogs = function () {
|
||||||
|
|
||||||
|
$scope.cyberPanelLoading = false;
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
listName: $scope.listName,
|
||||||
|
page: $scope.currentPageLogs,
|
||||||
|
recordsToShow: $scope.recordsToShowLogs
|
||||||
|
};
|
||||||
|
|
||||||
|
url = "/emailMarketing/fetchVerifyLogs";
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
|
||||||
|
|
||||||
|
function ListInitialData(response) {
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
$scope.recordsLogs = JSON.parse(response.data.logs);
|
||||||
|
$scope.paginationLogs = response.data.pagination;
|
||||||
|
$scope.totalEmails = response.data.totalEmails;
|
||||||
|
$scope.verified = response.data.verified;
|
||||||
|
$scope.notVerified = response.data.notVerified;
|
||||||
|
} else {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Error!',
|
||||||
|
text: response.data.error_message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function cantLoadInitialData(response) {
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: 'Could not connect to server, please refresh this page',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.controller('manageSMTPHostsCTRL', function ($scope, $http) {
|
app.controller('manageSMTPHostsCTRL', function ($scope, $http) {
|
||||||
@@ -1330,4 +1382,87 @@ app.controller('sendEmailsCTRL', function ($scope, $http, $timeout) {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.controller('configureVerify', function ($scope, $http) {
|
||||||
|
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
$scope.ipv4Hidden = true;
|
||||||
|
$scope.ipv6Hidden = true;
|
||||||
|
$scope.delayHidden = true;
|
||||||
|
|
||||||
|
$scope.delayInitial = function () {
|
||||||
|
if ($scope.delay === 'Disable') {
|
||||||
|
$scope.delayHidden = true;
|
||||||
|
} else {
|
||||||
|
$scope.delayHidden = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$scope.rotateInitial = function () {
|
||||||
|
if ($scope.rotation === 'Disable') {
|
||||||
|
$scope.rotationHidden = true;
|
||||||
|
} else if ($scope.rotation === 'IPv4') {
|
||||||
|
$scope.ipv4Hidden = false;
|
||||||
|
$scope.ipv6Hidden = true;
|
||||||
|
} else {
|
||||||
|
$scope.ipv4Hidden = true;
|
||||||
|
$scope.ipv6Hidden = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.saveChanges = function () {
|
||||||
|
|
||||||
|
$scope.cyberPanelLoading = false;
|
||||||
|
|
||||||
|
url = "/emailMarketing/saveConfigureVerify";
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
domain: $("#domainName").text(),
|
||||||
|
rotation: $scope.rotation,
|
||||||
|
delay: $scope.delay,
|
||||||
|
delayAfter: $scope.delayAfter,
|
||||||
|
delayTime: $scope.delayTime,
|
||||||
|
ipv4: $scope.ipv4,
|
||||||
|
ipv6: $scope.ipv6
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success!',
|
||||||
|
text: 'Successfully saved verification settings.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: response.data.error_message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
$scope.cyberPanelLoading = false;
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: 'Could not connect to server, please refresh this page',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user