mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 21:35:55 +01:00
Minor bug fix to API
This commit is contained in:
12
api/views.py
12
api/views.py
@@ -8,22 +8,16 @@ from plogical.virtualHostUtilities import virtualHostUtilities
|
|||||||
from plogical import hashPassword
|
from plogical import hashPassword
|
||||||
from plogical.installUtilities import installUtilities
|
from plogical.installUtilities import installUtilities
|
||||||
from packages.models import Package
|
from packages.models import Package
|
||||||
import shutil
|
|
||||||
from plogical.mysqlUtilities import mysqlUtilities
|
|
||||||
from databases.models import Databases
|
|
||||||
from baseTemplate.views import renderBase
|
from baseTemplate.views import renderBase
|
||||||
from random import randint
|
from random import randint
|
||||||
from websiteFunctions.models import Websites,ChildDomains
|
from websiteFunctions.models import Websites,ChildDomains
|
||||||
import os
|
import os
|
||||||
import signal
|
|
||||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
|
||||||
from shutil import rmtree
|
|
||||||
from baseTemplate.models import version
|
from baseTemplate.models import version
|
||||||
import subprocess
|
import subprocess
|
||||||
import shlex
|
import shlex
|
||||||
import re
|
import re
|
||||||
from dns.models import Domains,Records
|
|
||||||
from plogical.mailUtilities import mailUtilities
|
from plogical.mailUtilities import mailUtilities
|
||||||
|
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
|
|
||||||
@@ -35,7 +29,6 @@ def verifyConn(request):
|
|||||||
adminUser = data['adminUser']
|
adminUser = data['adminUser']
|
||||||
adminPass = data['adminPass']
|
adminPass = data['adminPass']
|
||||||
|
|
||||||
|
|
||||||
admin = Administrator.objects.get(userName=adminUser)
|
admin = Administrator.objects.get(userName=adminUser)
|
||||||
|
|
||||||
if hashPassword.check_password(admin.password, adminPass):
|
if hashPassword.check_password(admin.password, adminPass):
|
||||||
@@ -66,6 +59,9 @@ def createWebsite(request):
|
|||||||
websiteOwner = data['websiteOwner']
|
websiteOwner = data['websiteOwner']
|
||||||
ownerPassword = data['ownerPassword']
|
ownerPassword = data['ownerPassword']
|
||||||
externalApp = "".join(re.findall("[a-zA-Z]+", domain))[:7]
|
externalApp = "".join(re.findall("[a-zA-Z]+", domain))[:7]
|
||||||
|
data['ssl'] = 0
|
||||||
|
data['dkimCheck'] = 0
|
||||||
|
data['openBasedir'] = 1
|
||||||
|
|
||||||
|
|
||||||
phpSelection = "PHP 7.0"
|
phpSelection = "PHP 7.0"
|
||||||
|
|||||||
@@ -1139,9 +1139,7 @@ def submitRemoteBackups(request):
|
|||||||
|
|
||||||
if data['getVersion'] == 1:
|
if data['getVersion'] == 1:
|
||||||
|
|
||||||
Version = version.objects.get(pk=1)
|
if float(data['currentVersion']) >= 1.6 and data['build'] >= 0:
|
||||||
|
|
||||||
if data['currentVersion'] == Version.currentVersion and data['build'] >= 0:
|
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
data_ret = {'status': 0,
|
data_ret = {'status': 0,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="page-title">
|
<div id="page-title">
|
||||||
<h2>{% trans "ModSecurity Configurations!" %} </h2>
|
<h2>{% trans "ModSecurity Configurations!" %} - <a target="_blank" href="http://go.cyberpanel.net/modsec-docs" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "ModSec Docs" %}</span></a> </h2>
|
||||||
<p>{% trans "On this page you can configure ModSecurity settings." %}</p>
|
<p>{% trans "On this page you can configure ModSecurity settings." %}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="page-title">
|
<div id="page-title">
|
||||||
<h2>{% trans "ModSecurity Rules!" %} </h2>
|
<h2>{% trans "ModSecurity Rules!" %} - <a target="_blank" href="http://go.cyberpanel.net/modsec-docs" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "ModSec Docs" %}</span></a> </h2>
|
||||||
<p>{% trans "On this page you can add/delete ModSecurity rules." %}</p>
|
<p>{% trans "On this page you can add/delete ModSecurity rules." %}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="page-title">
|
<div id="page-title">
|
||||||
<h2>{% trans "ModSecurity Rules Packages!" %} </h2>
|
<h2>{% trans "ModSecurity Rules Packages!" %} - <a target="_blank" href="http://go.cyberpanel.net/modsec-docs" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "ModSec Docs" %}</span></a> </h2>
|
||||||
<p>{% trans "Install/Un-install ModSecurity rules packages." %}</p>
|
<p>{% trans "Install/Un-install ModSecurity rules packages." %}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="page-title">
|
<div id="page-title">
|
||||||
<h2>{% trans "Secure SSH" %}</h2>
|
<h2>{% trans "Secure SSH" %} - <a target="_blank" href="http://go.cyberpanel.net/ssh-docs" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "SSH Docs" %}</span></a></h2>
|
||||||
<p>{% trans "Secure or harden SSH Configurations." %}</p>
|
<p>{% trans "Secure or harden SSH Configurations." %}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -687,8 +687,8 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
while (1):
|
while (1):
|
||||||
#command = "wget http://cyberpanel.net/CyberPanel.1.6.4.tar.gz"
|
command = "wget http://cyberpanel.net/CyberPanel.1.7.0.tar.gz"
|
||||||
command = "wget http://cyberpanel.net/CyberPanelTemp.tar.gz"
|
#command = "wget http://cyberpanel.net/CyberPanelTemp.tar.gz"
|
||||||
res = subprocess.call(shlex.split(command))
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
@@ -707,8 +707,8 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
while(1):
|
while(1):
|
||||||
#command = "tar zxf CyberPanel.1.6.4.tar.gz"
|
command = "tar zxf CyberPanel.1.7.0.tar.gz"
|
||||||
command = "tar zxf CyberPanelTemp.tar.gz"
|
#command = "tar zxf CyberPanelTemp.tar.gz"
|
||||||
|
|
||||||
res = subprocess.call(shlex.split(command))
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
@@ -1271,7 +1271,7 @@ class preFlightsChecks:
|
|||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
while(1):
|
while(1):
|
||||||
command = 'openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /etc/postfix/key.pem -out /etc/postfix/cert.pem'
|
command = 'openssl req -newkey rsa:1024 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /etc/postfix/key.pem -out /etc/postfix/cert.pem'
|
||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
@@ -1293,7 +1293,7 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
while(1):
|
while(1):
|
||||||
|
|
||||||
command = 'openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /etc/dovecot/key.pem -out /etc/dovecot/cert.pem'
|
command = 'openssl req -newkey rsa:1024 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /etc/dovecot/key.pem -out /etc/dovecot/cert.pem'
|
||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
@@ -2048,6 +2048,10 @@ class preFlightsChecks:
|
|||||||
break
|
break
|
||||||
|
|
||||||
######
|
######
|
||||||
|
command = 'systemctl restart dbus'
|
||||||
|
cmd = shlex.split(command)
|
||||||
|
subprocess.call(cmd)
|
||||||
|
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
|
|||||||
@@ -762,7 +762,7 @@ class InstallCyberPanel:
|
|||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
while(1):
|
while(1):
|
||||||
command = 'openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem'
|
command = 'openssl req -newkey rsa:1024 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem'
|
||||||
res = subprocess.call(shlex.split(command))
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
@@ -1128,7 +1128,7 @@ class InstallCyberPanel:
|
|||||||
count = 0
|
count = 0
|
||||||
while(1):
|
while(1):
|
||||||
|
|
||||||
command = 'openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /usr/local/lscp/key.pem -out /usr/local/lscp/cert.pem'
|
command = 'openssl req -newkey rsa:1024 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /usr/local/lscp/key.pem -out /usr/local/lscp/cert.pem'
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd)
|
res = subprocess.call(cmd)
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,6 @@ AltLog clf:/var/log/pureftpd.log
|
|||||||
CreateHomeDir yes
|
CreateHomeDir yes
|
||||||
MaxDiskUsage 99
|
MaxDiskUsage 99
|
||||||
CustomerProof yes
|
CustomerProof yes
|
||||||
TLS 2
|
TLS 1
|
||||||
PassivePortRange 40110 40210
|
PassivePortRange 40110 40210
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,6 @@ AltLog clf:/var/log/pureftpd.log
|
|||||||
CreateHomeDir yes
|
CreateHomeDir yes
|
||||||
MaxDiskUsage 99
|
MaxDiskUsage 99
|
||||||
CustomerProof yes
|
CustomerProof yes
|
||||||
TLS 2
|
TLS 1
|
||||||
PassivePortRange 40110 40210
|
PassivePortRange 40110 40210
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
<div class="col-md-8 col-lg-6 clearfix center-margin">
|
<div class="col-md-8 col-lg-6 clearfix center-margin">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
<h3 class="text-transform-upr font-size-17">CyberPanel <span class="opacity-80">v 1.6</span></h3>
|
<h3 class="text-transform-upr font-size-17">CyberPanel <span class="opacity-80">v 1.7</span></h3>
|
||||||
<p class="font-gray">Web Hosting Control Panel</p>
|
<p class="font-gray">Web Hosting Control Panel</p>
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
<ul class="reset-ul">
|
<ul class="reset-ul">
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ def loadLoginPage(request):
|
|||||||
firstName="Cyber",lastName="Panel")
|
firstName="Cyber",lastName="Panel")
|
||||||
admin.save()
|
admin.save()
|
||||||
|
|
||||||
vers = version(currentVersion="1.6",build=4)
|
vers = version(currentVersion="1.7",build=0)
|
||||||
vers.save()
|
vers.save()
|
||||||
|
|
||||||
package = Package(admin=admin, packageName="Default", diskSpace=1000,
|
package = Package(admin=admin, packageName="Default", diskSpace=1000,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="page-title">
|
<div id="page-title">
|
||||||
<h2>{% trans "Manage SSL" %}</h2>
|
<h2>{% trans "Manage SSL" %} - <a target="_blank" href="http://go.cyberpanel.net/ssl-docs" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "SSL Docs" %}</span></a></h2>
|
||||||
<p>{% trans "This page can be used to issue Let’s Encrypt SSL for existing websites on server." %}</p>
|
<p>{% trans "This page can be used to issue Let’s Encrypt SSL for existing websites on server." %}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="page-title">
|
<div id="page-title">
|
||||||
<h2>{% trans "Issue SSL For Hostname" %}</h2>
|
<h2>{% trans "Issue SSL For Hostname" %} - <a target="_blank" href="http://go.cyberpanel.net/hostname-ssl" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "SSL Docs" %}</span></a></h2>
|
||||||
<p>{% trans "Let’s Encrypt SSL for hostname to access CyberPanel on verified SSL." %}</p>
|
<p>{% trans "Let’s Encrypt SSL for hostname to access CyberPanel on verified SSL." %}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="page-title">
|
<div id="page-title">
|
||||||
<h2>{% trans "Issue SSL For MailServer" %}</h2>
|
<h2>{% trans "Issue SSL For MailServer" %} - <a target="_blank" href="http://go.cyberpanel.net/mailserver-ssl" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "SSL Docs" %}</span></a></h2>
|
||||||
<p>{% trans "Let’s Encrypt SSL for MailServer (Postfix/Dovecot)." %}</p>
|
<p>{% trans "Let’s Encrypt SSL for MailServer (Postfix/Dovecot)." %}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,285 @@
|
|||||||
import os
|
import os
|
||||||
|
import os.path
|
||||||
|
import sys
|
||||||
|
import django
|
||||||
|
sys.path.append('/usr/local/CyberCP')
|
||||||
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||||
|
django.setup()
|
||||||
import shlex
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
import shutil
|
import shutil
|
||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
|
from baseTemplate.models import version
|
||||||
|
|
||||||
class Upgrade:
|
class Upgrade:
|
||||||
logPath = "/usr/local/lscp/logs/upgradeLog"
|
logPath = "/usr/local/lscp/logs/upgradeLog"
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def stdOut(message):
|
||||||
|
print("\n\n")
|
||||||
|
print ("[" + time.strftime(
|
||||||
|
"%I-%M-%S-%a-%b-%Y") + "] #########################################################################\n")
|
||||||
|
print("[" + time.strftime("%I-%M-%S-%a-%b-%Y") + "] " + message + "\n")
|
||||||
|
print ("[" + time.strftime(
|
||||||
|
"%I-%M-%S-%a-%b-%Y") + "] #########################################################################\n")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def downloadLink():
|
def downloadLink():
|
||||||
|
try:
|
||||||
url = "https://cyberpanel.net/version.txt"
|
url = "https://cyberpanel.net/version.txt"
|
||||||
r = requests.get(url, verify=True)
|
r = requests.get(url, verify=True)
|
||||||
data = json.loads(r.text)
|
data = json.loads(r.text)
|
||||||
version_number = str(data['version'])
|
version_number = str(data['version'])
|
||||||
version_build = str(data['build'])
|
version_build = str(data['build'])
|
||||||
return ("Temp.tar.gz")
|
return (version_number + "." + version_build + ".tar.gz")
|
||||||
|
except BaseException, msg:
|
||||||
|
Upgrade.stdOut(str(msg) + ' [downloadLink]')
|
||||||
|
os._exit(0)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def setupVirtualEnv():
|
||||||
|
try:
|
||||||
|
##
|
||||||
|
count = 0
|
||||||
|
while (1):
|
||||||
|
command = "yum install -y libattr-devel xz-devel gpgme-devel mariadb-devel curl-devel"
|
||||||
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
if res == 1:
|
||||||
|
count = count + 1
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Trying to install project dependant modules, trying again, try number: " + str(count))
|
||||||
|
if count == 3:
|
||||||
|
Upgrade.stdOut("Failed to install project dependant modules! [setupVirtualEnv]")
|
||||||
|
os._exit(0)
|
||||||
|
else:
|
||||||
|
Upgrade.stdOut("Project dependant modules installed successfully!!")
|
||||||
|
break
|
||||||
|
|
||||||
|
##
|
||||||
|
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
while (1):
|
||||||
|
command = "pip install virtualenv"
|
||||||
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
if res == 1:
|
||||||
|
count = count + 1
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Trying to install virtualenv, trying again, try number: " + str(count))
|
||||||
|
if count == 3:
|
||||||
|
Upgrade.stdOut("Failed install virtualenv! [setupVirtualEnv]")
|
||||||
|
os._exit(0)
|
||||||
|
else:
|
||||||
|
Upgrade.stdOut("virtualenv installed successfully!")
|
||||||
|
break
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
while (1):
|
||||||
|
command = "virtualenv --system-site-packages /usr/local/CyberCP"
|
||||||
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
if res == 1:
|
||||||
|
count = count + 1
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Trying to setup virtualenv, trying again, try number: " + str(count))
|
||||||
|
if count == 3:
|
||||||
|
Upgrade.stdOut("Failed to setup virtualenv! [setupVirtualEnv]")
|
||||||
|
os._exit(0)
|
||||||
|
else:
|
||||||
|
Upgrade.stdOut("virtualenv setuped successfully!")
|
||||||
|
break
|
||||||
|
|
||||||
|
##
|
||||||
|
|
||||||
|
env_path = '/usr/local/CyberCP'
|
||||||
|
subprocess.call(['virtualenv', env_path])
|
||||||
|
activate_this = os.path.join(env_path, 'bin', 'activate_this.py')
|
||||||
|
execfile(activate_this, dict(__file__=activate_this))
|
||||||
|
|
||||||
|
##
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
while (1):
|
||||||
|
command = "pip install --ignore-installed -r /usr/local/CyberCP/requirments.txt"
|
||||||
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
if res == 1:
|
||||||
|
count = count + 1
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Trying to install project dependant modules, trying again, try number: " + str(count))
|
||||||
|
if count == 3:
|
||||||
|
Upgrade.InstallLog.writeToFile(
|
||||||
|
"Failed to install project dependant modules! [setupVirtualEnv]")
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
Upgrade.stdOut("Project dependant modules installed successfully!!")
|
||||||
|
break
|
||||||
|
|
||||||
|
command = "systemctl stop gunicorn.socket"
|
||||||
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
command = "virtualenv --system-site-packages /usr/local/CyberCP"
|
||||||
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
|
||||||
|
except OSError, msg:
|
||||||
|
Upgrade.stdOut(str(msg) + " [setupVirtualEnv]")
|
||||||
|
os._exit(0)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def upgradeOpenLiteSpeed():
|
||||||
|
try:
|
||||||
|
##
|
||||||
|
count = 0
|
||||||
|
while (1):
|
||||||
|
command = "yum upgrade -y openlitespeed"
|
||||||
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
if res == 1:
|
||||||
|
count = count + 1
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Trying to upgrade OpenLiteSpeed, trying again, try number: " + str(count))
|
||||||
|
if count == 3:
|
||||||
|
Upgrade.stdOut("Failed to upgrade OpenLiteSpeed! [upgradeOpenLiteSpeed]")
|
||||||
|
else:
|
||||||
|
Upgrade.stdOut("OpenLiteSpeed successfully upgraded!")
|
||||||
|
break
|
||||||
|
|
||||||
|
##
|
||||||
|
|
||||||
|
except OSError, msg:
|
||||||
|
Upgrade.stdOut(str(msg) + " [upgradeOpenLiteSpeed]")
|
||||||
|
os._exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def updateGunicornConf():
|
||||||
|
try:
|
||||||
|
path = '/etc/systemd/system/gunicorn.service'
|
||||||
|
|
||||||
|
cont = """[Unit]
|
||||||
|
Description=gunicorn daemon
|
||||||
|
Requires=gunicorn.socket
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
PIDFile=/run/gunicorn/pid
|
||||||
|
User=cyberpanel
|
||||||
|
Group=cyberpanel
|
||||||
|
RuntimeDirectory=gunicorn
|
||||||
|
WorkingDirectory=/usr/local/CyberCP
|
||||||
|
ExecStart=/usr/local/CyberCP/bin/gunicorn --pid /run/gunicorn/gucpid \
|
||||||
|
--bind 127.0.0.1:5003 CyberCP.wsgi
|
||||||
|
ExecReload=/bin/kill -s HUP $MAINPID
|
||||||
|
ExecStop=/bin/kill -s TERM $MAINPID
|
||||||
|
PrivateTmp=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target"""
|
||||||
|
|
||||||
|
writeToFile = open(path, 'w')
|
||||||
|
writeToFile.write(cont)
|
||||||
|
writeToFile.close()
|
||||||
|
|
||||||
|
|
||||||
|
command = 'systemctl daemon-reload'
|
||||||
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
command = 'systemctl restart gunicorn.socket'
|
||||||
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
except BaseException, msg:
|
||||||
|
Upgrade.stdOut(str(msg) + " [updateGunicornConf]")
|
||||||
|
os._exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def fileManager():
|
||||||
|
## Copy File manager files
|
||||||
|
|
||||||
|
count = 1
|
||||||
|
while (1):
|
||||||
|
command = "rm -rf /usr/local/lsws/Example/html/FileManager"
|
||||||
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
if res == 1:
|
||||||
|
count = count + 1
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Trying to remove old File manager files, try number: " + str(count))
|
||||||
|
if count == 3:
|
||||||
|
Upgrade.stdOut("Failed to remove old File manager files! [upgrade]")
|
||||||
|
os._exit(0)
|
||||||
|
else:
|
||||||
|
Upgrade.stdOut("Old File Manager files successfully removed!")
|
||||||
|
break
|
||||||
|
|
||||||
|
count = 1
|
||||||
|
while (1):
|
||||||
|
command = "mv /usr/local/CyberCP/install/FileManager /usr/local/lsws/Example/html"
|
||||||
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
if res == 1:
|
||||||
|
count = count + 1
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Trying to upgrade File manager, try number: " + str(count))
|
||||||
|
if count == 3:
|
||||||
|
Upgrade.stdOut("Failed to upgrade File manager! [upgrade]")
|
||||||
|
os._exit(0)
|
||||||
|
else:
|
||||||
|
Upgrade.stdOut("File manager successfully upgraded!")
|
||||||
|
break
|
||||||
|
|
||||||
|
command = "chmod -R 777 /usr/local/lsws/Example/html/FileManager"
|
||||||
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def staticContent():
|
||||||
|
count = 1
|
||||||
|
while (1):
|
||||||
|
command = "rm -rf /usr/local/lscp/cyberpanel/static"
|
||||||
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
if res == 1:
|
||||||
|
count = count + 1
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Trying to remove old static content, try number: " + str(count))
|
||||||
|
if count == 3:
|
||||||
|
Upgrade.stdOut("Failed to remove old static content! [upgrade]")
|
||||||
|
os._exit(0)
|
||||||
|
else:
|
||||||
|
Upgrade.stdOut("Static content successfully removed!")
|
||||||
|
break
|
||||||
|
|
||||||
|
count = 1
|
||||||
|
while (1):
|
||||||
|
command = "mv /usr/local/CyberCP/static /usr/local/lscp/cyberpanel"
|
||||||
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
if res == 1:
|
||||||
|
count = count + 1
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Trying to update static content, try number: " + str(count))
|
||||||
|
if count == 3:
|
||||||
|
Upgrade.stdOut("Failed to update static content! [upgrade]")
|
||||||
|
os._exit(0)
|
||||||
|
else:
|
||||||
|
Upgrade.stdOut("Static content in place!")
|
||||||
|
break
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def upgradeVersion():
|
||||||
|
vers = version.objects.get(pk=1)
|
||||||
|
getVersion = requests.get('https://cyberpanel.net/version.txt')
|
||||||
|
latest = getVersion.json()
|
||||||
|
vers.currentVersion = latest['version']
|
||||||
|
vers.build = latest['build']
|
||||||
|
vers.save()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -25,83 +288,221 @@ class Upgrade:
|
|||||||
|
|
||||||
os.chdir("/usr/local")
|
os.chdir("/usr/local")
|
||||||
|
|
||||||
|
## Current Version
|
||||||
|
|
||||||
|
Version = version.objects.get(pk=1)
|
||||||
|
|
||||||
|
##
|
||||||
|
|
||||||
versionNumbring = Upgrade.downloadLink()
|
versionNumbring = Upgrade.downloadLink()
|
||||||
|
|
||||||
|
if float(Version.currentVersion) < 1.6:
|
||||||
|
Upgrade.stdOut('Upgrades works for version 1.6 onwards.')
|
||||||
|
os._exit(0)
|
||||||
|
|
||||||
|
## RC Check
|
||||||
|
|
||||||
|
rcCheck = 1
|
||||||
|
|
||||||
|
if os.path.exists('/usr/local/CyberCP/postfixSenderPolicy'):
|
||||||
|
rcCheck = 0
|
||||||
|
|
||||||
## Download latest version.
|
## Download latest version.
|
||||||
|
|
||||||
command = "wget https://cyberpanel.net/CyberPanel" + versionNumbring
|
count = 0
|
||||||
subprocess.call(shlex.split(command))
|
while (1):
|
||||||
|
command = "wget https://cyberpanel.net/CyberPanel." + versionNumbring
|
||||||
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
if res == 1:
|
||||||
|
count = count + 1
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Downloading latest version, trying again, try number: " + str(count))
|
||||||
|
if count == 3:
|
||||||
|
Upgrade.stdOut("Failed to download latest version! [upgrade]")
|
||||||
|
os._exit(0)
|
||||||
|
else:
|
||||||
|
Upgrade.stdOut("Latest version successfully downloaded!")
|
||||||
|
break
|
||||||
|
|
||||||
## Backup settings file.
|
## Backup settings file.
|
||||||
|
|
||||||
|
Upgrade.stdOut("Backing up settings file.")
|
||||||
|
|
||||||
shutil.copy("/usr/local/CyberCP/CyberCP/settings.py","/usr/local/settings.py")
|
shutil.copy("/usr/local/CyberCP/CyberCP/settings.py","/usr/local/settings.py")
|
||||||
|
|
||||||
|
Upgrade.stdOut("Settings file backed up.")
|
||||||
|
|
||||||
## Remove Core Files
|
## Remove Core Files
|
||||||
|
|
||||||
|
count = 1
|
||||||
|
while (1):
|
||||||
command = "rm -rf /usr/local/CyberCP"
|
command = "rm -rf /usr/local/CyberCP"
|
||||||
subprocess.call(shlex.split(command))
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
if res == 1:
|
||||||
|
count = count + 1
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Trying to remove old version, trying again, try number: " + str(count))
|
||||||
|
if count == 3:
|
||||||
|
Upgrade.stdOut("Failed to remove old version! [upgrade]")
|
||||||
|
os._exit(0)
|
||||||
|
else:
|
||||||
|
Upgrade.stdOut("Old version successfully removed!")
|
||||||
|
break
|
||||||
|
|
||||||
## Extract Latest files
|
## Extract Latest files
|
||||||
|
|
||||||
command = "tar zxf CyberPanel" + versionNumbring
|
count = 1
|
||||||
subprocess.call(shlex.split(command))
|
while (1):
|
||||||
|
command = "tar zxf CyberPanel." + versionNumbring
|
||||||
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
if res == 1:
|
||||||
|
count = count + 1
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Trying to extract new version, trying again, try number: " + str(count))
|
||||||
|
if count == 3:
|
||||||
|
Upgrade.stdOut("Failed to extract new version! [upgrade]")
|
||||||
|
os._exit(0)
|
||||||
|
else:
|
||||||
|
Upgrade.stdOut("New version successfully extracted!")
|
||||||
|
break
|
||||||
|
|
||||||
## Copy settings file
|
## Copy settings file
|
||||||
|
|
||||||
shutil.copy("/usr/local/settings.py", "/usr/local/CyberCP/CyberCP/")
|
Upgrade.stdOut('Restoring settings file!')
|
||||||
|
|
||||||
|
|
||||||
|
data = open("/usr/local/settings.py", 'r').readlines()
|
||||||
|
writeToFile = open("/usr/local/CyberCP/CyberCP/settings.py", 'w')
|
||||||
|
|
||||||
|
for items in data:
|
||||||
|
if items.find("'filemanager',") > -1:
|
||||||
|
writeToFile.writelines(items)
|
||||||
|
if Version.currentVersion == '1.6':
|
||||||
|
writeToFile.writelines(" 'emailPremium'\n")
|
||||||
|
else:
|
||||||
|
writeToFile.writelines(items)
|
||||||
|
|
||||||
|
writeToFile.close()
|
||||||
|
|
||||||
|
Upgrade.stdOut('Settings file restored!')
|
||||||
|
|
||||||
## Move static files
|
## Move static files
|
||||||
|
|
||||||
command = "rm -rf /usr/local/lscp/cyberpanel/static"
|
Upgrade.staticContent()
|
||||||
subprocess.call(shlex.split(command))
|
|
||||||
|
|
||||||
command = "mv /usr/local/CyberCP/static /usr/local/lscp/cyberpanel"
|
## Upgrade File Manager
|
||||||
subprocess.call(shlex.split(command))
|
|
||||||
|
|
||||||
## Copy File manager files
|
Upgrade.fileManager()
|
||||||
|
|
||||||
command = "rm -rf /usr/local/lsws/Example/html/FileManager"
|
|
||||||
subprocess.call(shlex.split(command))
|
|
||||||
|
|
||||||
command = "mv /usr/local/CyberCP/install/FileManager /usr/local/lsws/Example/html"
|
|
||||||
subprocess.call(shlex.split(command))
|
|
||||||
|
|
||||||
|
|
||||||
## Install TLDExtract
|
## Install TLDExtract
|
||||||
|
|
||||||
|
count = 1
|
||||||
|
while (1):
|
||||||
command = "pip install tldextract"
|
command = "pip install tldextract"
|
||||||
subprocess.call(shlex.split(command))
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
if res == 1:
|
||||||
|
count = count + 1
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Trying to install tldextract, trying again, try number: " + str(count))
|
||||||
|
if count == 3:
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Failed to install tldextract! [upgrade]")
|
||||||
|
os._exit(0)
|
||||||
|
else:
|
||||||
|
Upgrade.stdOut("tldextract successfully installed! [pip]")
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Install dnspython
|
## Install dnspython
|
||||||
|
|
||||||
#command = "pip install dnspython"
|
#command = "pip install dnspython"
|
||||||
#subprocess.call(shlex.split(command))
|
#subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
## Change File manager permissions
|
|
||||||
|
|
||||||
command = "chmod -R 777 /usr/local/lsws/Example/html/FileManager"
|
|
||||||
subprocess.call(shlex.split(command))
|
|
||||||
|
|
||||||
## MailServer Model Changes
|
## MailServer Model Changes
|
||||||
|
|
||||||
|
if Version.currentVersion == '1.6' and rcCheck :
|
||||||
os.chdir('/usr/local/CyberCP')
|
os.chdir('/usr/local/CyberCP')
|
||||||
|
|
||||||
|
count = 1
|
||||||
|
while (1):
|
||||||
command = "echo 'ALTER TABLE e_forwardings DROP PRIMARY KEY;ALTER TABLE e_forwardings ADD id INT AUTO_INCREMENT PRIMARY KEY;' | python manage.py dbshell"
|
command = "echo 'ALTER TABLE e_forwardings DROP PRIMARY KEY;ALTER TABLE e_forwardings ADD id INT AUTO_INCREMENT PRIMARY KEY;' | python manage.py dbshell"
|
||||||
subprocess.check_output(command, shell=True)
|
res = subprocess.check_output(command, shell=True)
|
||||||
|
|
||||||
## Restart Gunicorn
|
if res == 1:
|
||||||
|
count = count + 1
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Trying to patch database for email forwarding, trying again, try number: " + str(count))
|
||||||
|
if count == 3:
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Failed to patch database for email forwarding! [upgrade]")
|
||||||
|
os._exit(0)
|
||||||
|
|
||||||
command = "systemctl restart gunicorn.socket"
|
else:
|
||||||
|
Upgrade.stdOut("Database successfully patched for email forwarding!")
|
||||||
|
break
|
||||||
|
|
||||||
|
count = 1
|
||||||
|
while (1):
|
||||||
|
command = "python manage.py makemigrations emailPremium"
|
||||||
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
if res == 1:
|
||||||
|
count = count + 1
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Trying to setup migration file for email limits, trying again, try number: " + str(count))
|
||||||
|
if count == 3:
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Failed to setup migration file for email limits! [upgrade]")
|
||||||
|
os._exit(0)
|
||||||
|
else:
|
||||||
|
Upgrade.stdOut("Migrations file for email limits successfully prepared!")
|
||||||
|
break
|
||||||
|
|
||||||
|
count = 1
|
||||||
|
while (1):
|
||||||
|
command = "python manage.py migrate emailPremium"
|
||||||
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
if res == 1:
|
||||||
|
count = count + 1
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Trying to execute migration file for email limits, trying again, try number: " + str(count))
|
||||||
|
if count == 3:
|
||||||
|
Upgrade.stdOut(
|
||||||
|
"Failed to execute migration file for email limits! [upgrade]")
|
||||||
|
os._exit(0)
|
||||||
|
else:
|
||||||
|
Upgrade.stdOut("Migrations file for email limits successfully executed!")
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
Upgrade.stdOut('Setting up virtual enviroment for CyberPanel.')
|
||||||
|
Upgrade.setupVirtualEnv()
|
||||||
|
Upgrade.stdOut('Virtual enviroment for CyberPanel successfully installed.')
|
||||||
|
if Version.currentVersion == '1.6':
|
||||||
|
Upgrade.updateGunicornConf()
|
||||||
|
command = 'systemctl restart gunicorn.socket'
|
||||||
subprocess.call(shlex.split(command))
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
|
||||||
|
## Upgrade OpenLiteSpeed
|
||||||
|
|
||||||
|
Upgrade.upgradeOpenLiteSpeed()
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
## Upgrade version
|
## Upgrade version
|
||||||
|
|
||||||
r = requests.post("http://localhost:5003/base/upgradeVersion")
|
Upgrade.upgradeVersion()
|
||||||
|
|
||||||
|
|
||||||
print("Upgrade Completed.")
|
Upgrade.stdOut("Upgrade Completed.")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -34,15 +34,22 @@ class HandleRequest(multi.Thread):
|
|||||||
while True:
|
while True:
|
||||||
|
|
||||||
Data = self.connection.recv(64)
|
Data = self.connection.recv(64)
|
||||||
|
|
||||||
# Wait for a connection
|
# Wait for a connection
|
||||||
|
|
||||||
|
try:
|
||||||
if os.path.exists(HandleRequest.cleaningPath):
|
if os.path.exists(HandleRequest.cleaningPath):
|
||||||
|
|
||||||
readFromFile = open(HandleRequest.cleaningPath, 'r')
|
readFromFile = open(HandleRequest.cleaningPath, 'r')
|
||||||
command = readFromFile.read()
|
command = readFromFile.read()
|
||||||
|
|
||||||
cacheManager.handlePurgeRequest(command)
|
cacheManager.handlePurgeRequest(command)
|
||||||
|
|
||||||
readFromFile.close()
|
readFromFile.close()
|
||||||
|
|
||||||
os.remove(HandleRequest.cleaningPath)
|
os.remove(HandleRequest.cleaningPath)
|
||||||
cacheManager.flushCache()
|
cacheManager.flushCache()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
if Data:
|
if Data:
|
||||||
if len(Data) < 64:
|
if len(Data) < 64:
|
||||||
@@ -62,16 +69,22 @@ class HandleRequest(multi.Thread):
|
|||||||
|
|
||||||
def manageRequest(self, completeData):
|
def manageRequest(self, completeData):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
completeData = completeData.split('\n')
|
completeData = completeData.split('\n')
|
||||||
|
|
||||||
for items in completeData:
|
for items in completeData:
|
||||||
tempData = items.split('=')
|
tempData = items.split('=')
|
||||||
if tempData[0] == 'sender':
|
if tempData[0] == 'sasl_username':
|
||||||
|
if len(tempData[1]) == 0:
|
||||||
|
self.connection.sendall('action=dunno\n\n')
|
||||||
|
return
|
||||||
emailAddress = tempData[1]
|
emailAddress = tempData[1]
|
||||||
domainName = emailAddress.split('@')[1]
|
domainName = emailAddress.split('@')[1]
|
||||||
elif tempData[0] == 'recipient':
|
elif tempData[0] == 'recipient':
|
||||||
destination = tempData[1]
|
destination = tempData[1]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if domainName in cacheManager.domains:
|
if domainName in cacheManager.domains:
|
||||||
domainObj = cacheManager.domains[domainName]
|
domainObj = cacheManager.domains[domainName]
|
||||||
emailObj = domainObj.findEmailOBJ(emailAddress)
|
emailObj = domainObj.findEmailOBJ(emailAddress)
|
||||||
@@ -95,9 +108,11 @@ class HandleRequest(multi.Thread):
|
|||||||
#logging.writeToFile('Email Monthly Used: ' + str(emailObj.monthlyUsed))
|
#logging.writeToFile('Email Monthly Used: ' + str(emailObj.monthlyUsed))
|
||||||
|
|
||||||
if domainObj.limitStatus == 1 and emailObj.limitStatus == 1:
|
if domainObj.limitStatus == 1 and emailObj.limitStatus == 1:
|
||||||
|
|
||||||
if domainObj.monthlyLimits <= domainObj.monthlyUsed or emailObj.monthlyLimits <= emailObj.monthlyUsed or emailObj.hourlyLimits <= emailObj.hourlyUsed:
|
if domainObj.monthlyLimits <= domainObj.monthlyUsed or emailObj.monthlyLimits <= emailObj.monthlyUsed or emailObj.hourlyLimits <= emailObj.hourlyUsed:
|
||||||
logging.writeToFile(emailAddress + ' either exceeded monthly or hourly sending limit.')
|
logging.writeToFile(emailAddress + ' either exceeded monthly or hourly sending limit.')
|
||||||
self.connection.sendall('action=defer_if_permit Service temporarily unavailable\n\n')
|
self.connection.sendall('action=defer_if_permit Service temporarily unavailable\n\n')
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
email = EUsers.objects.get(email=emailAddress)
|
email = EUsers.objects.get(email=emailAddress)
|
||||||
if emailObj.logStatus == 1:
|
if emailObj.logStatus == 1:
|
||||||
@@ -113,8 +128,10 @@ class HandleRequest(multi.Thread):
|
|||||||
logEntry = EmailLogs(email=email, destination=destination,
|
logEntry = EmailLogs(email=email, destination=destination,
|
||||||
timeStamp=time.strftime("%I-%M-%S-%a-%b-%Y"))
|
timeStamp=time.strftime("%I-%M-%S-%a-%b-%Y"))
|
||||||
logEntry.save()
|
logEntry.save()
|
||||||
|
|
||||||
emailObj.monthlyUsed = emailObj.monthlyUsed + 1
|
emailObj.monthlyUsed = emailObj.monthlyUsed + 1
|
||||||
emailObj.hourlyUsed = emailObj.hourlyUsed + 1
|
emailObj.hourlyUsed = emailObj.hourlyUsed + 1
|
||||||
|
domainObj.monthlyUsed = domainObj.monthlyUsed + 1
|
||||||
self.connection.sendall('action=dunno\n\n')
|
self.connection.sendall('action=dunno\n\n')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,6 @@ class cacheManager:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def hourlyCleanUP():
|
def hourlyCleanUP():
|
||||||
try:
|
try:
|
||||||
|
|
||||||
for domain, domainOBJ in cacheManager.domains.iteritems():
|
for domain, domainOBJ in cacheManager.domains.iteritems():
|
||||||
for email, emailOBJ in domainOBJ.emails.iteritems():
|
for email, emailOBJ in domainOBJ.emails.iteritems():
|
||||||
|
|
||||||
@@ -133,12 +132,8 @@ class cacheManager:
|
|||||||
dbEmail.hourlyUsed = 0
|
dbEmail.hourlyUsed = 0
|
||||||
dbEmail.save()
|
dbEmail.save()
|
||||||
|
|
||||||
emailID = EUsers.objects.get(email=email)
|
|
||||||
dbEmail = EmailLimits.objects.get(email=emailID)
|
|
||||||
|
|
||||||
dbEmail.hourlyUsed = 0
|
dbEmail.hourlyUsed = 0
|
||||||
emailOBJ.hourlyUsed = 0
|
emailOBJ.hourlyUsed = 0
|
||||||
dbEmail.save()
|
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.writeToFile(str(msg) + ' [cacheManager.hourlyCleanUP]')
|
logging.writeToFile(str(msg) + ' [cacheManager.hourlyCleanUP]')
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ class policyConstraints:
|
|||||||
def findEmailOBJ(self, emailAddress):
|
def findEmailOBJ(self, emailAddress):
|
||||||
if emailAddress in self.emails:
|
if emailAddress in self.emails:
|
||||||
return self.emails[emailAddress]
|
return self.emails[emailAddress]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
email = EUsers.objects.get(email=emailAddress)
|
email = EUsers.objects.get(email=emailAddress)
|
||||||
emailLTS = EmailLimits.objects.get(email=email)
|
emailLTS = EmailLimits.objects.get(email=email)
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ class SetupConn:
|
|||||||
try:
|
try:
|
||||||
self.sock.listen(5)
|
self.sock.listen(5)
|
||||||
while True:
|
while True:
|
||||||
|
try:
|
||||||
# Wait for a connection
|
# Wait for a connection
|
||||||
if os.path.exists(SetupConn.cleaningPath):
|
if os.path.exists(SetupConn.cleaningPath):
|
||||||
readFromFile = open(SetupConn.cleaningPath, 'r')
|
readFromFile = open(SetupConn.cleaningPath, 'r')
|
||||||
@@ -57,6 +58,8 @@ class SetupConn:
|
|||||||
cacheManager.handlePurgeRequest(command)
|
cacheManager.handlePurgeRequest(command)
|
||||||
readFromFile.close()
|
readFromFile.close()
|
||||||
os.remove(SetupConn.cleaningPath)
|
os.remove(SetupConn.cleaningPath)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
connection, client_address = self.sock.accept()
|
connection, client_address = self.sock.accept()
|
||||||
background = handle.HandleRequest(connection)
|
background = handle.HandleRequest(connection)
|
||||||
|
|||||||
@@ -102,7 +102,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">{% trans "Username" %}</label>
|
<label class="col-sm-3 control-label">{% trans "Username" %}</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<input name="username" ng-pattern="/^[a-zA-Z0-9]+$/" ng-change="hideSomeThings()" type="text" class="form-control" ng-model="userName" required>
|
<input name="username" ng-change="hideSomeThings()" type="text" class="form-control" ng-model="userName" required>
|
||||||
</div>
|
</div>
|
||||||
<div ng-show="createUser.username.$error.pattern" class="current-pack">{% trans "Username should be lowercase alphanumeric." %}</div>
|
<div ng-show="createUser.username.$error.pattern" class="current-pack">{% trans "Username should be lowercase alphanumeric." %}</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">{% trans "Password" %}</label>
|
<label class="col-sm-3 control-label">{% trans "Password" %}</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<input name="password" ng-pattern="/^(?=.*?[a-zA-Z])(?=.*\d)([a-zA-Z0-9])+$/" type="password" class="form-control" ng-model="password" required>
|
<input name="password" type="password" class="form-control" ng-model="password" required>
|
||||||
</div>
|
</div>
|
||||||
<div ng-show="createUser.password.$error.pattern" class="current-pack">{% trans "Must contain one number and one special character." %}</div>
|
<div ng-show="createUser.password.$error.pattern" class="current-pack">{% trans "Must contain one number and one special character." %}</div>
|
||||||
|
|
||||||
@@ -123,9 +123,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label"></label>
|
<label class="col-sm-3 control-label"></label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<button ng-disabled="createUser.password.$error.pattern ||
|
<button ng-disabled="createUser.websitesLimit.$error.number ||
|
||||||
createUser.username.$error.pattern ||
|
|
||||||
createUser.websitesLimit.$error.number ||
|
|
||||||
createUser.userAccountsLimit.$error.number ||
|
createUser.userAccountsLimit.$error.number ||
|
||||||
createUser.email.$error.email ||
|
createUser.email.$error.email ||
|
||||||
createUser.firstName.$error.pattern ||
|
createUser.firstName.$error.pattern ||
|
||||||
|
|||||||
Reference in New Issue
Block a user