mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-01-17 13:02:07 +01:00
Merge branch 'stable' into v2.0.1
This commit is contained in:
@@ -12,6 +12,7 @@ urlpatterns = [
|
||||
|
||||
url(r'^getUserInfo$', views.getUserInfo, name='getUserInfo'),
|
||||
url(r'^changeUserPassAPI', views.changeUserPassAPI, name='changeUserPassAPI'),
|
||||
url(r'^submitUserDeletion$', views.submitUserDeletion, name='submitUserDeletion'),
|
||||
|
||||
url(r'^changePackageAPI', views.changePackageAPI, name='changePackageAPI'),
|
||||
url(r'^fetchSSHkey', views.fetchSSHkey, name='fetchSSHkey'),
|
||||
@@ -25,4 +26,4 @@ urlpatterns = [
|
||||
url(r'^runAWSBackups$', views.runAWSBackups, name='runAWSBackups'),
|
||||
url(r'^submitUserCreation$', views.submitUserCreation, name='submitUserCreation'),
|
||||
|
||||
]
|
||||
]
|
||||
|
||||
37
api/views.py
37
api/views.py
@@ -19,6 +19,7 @@ from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from userManagment.views import submitUserCreation as suc
|
||||
from userManagment.views import submitUserDeletion as duc
|
||||
# Create your views here.
|
||||
|
||||
@csrf_exempt
|
||||
@@ -119,7 +120,6 @@ def changeUserPassAPI(request):
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
|
||||
websiteOwner = data['websiteOwner']
|
||||
ownerPassword = data['ownerPassword']
|
||||
|
||||
@@ -155,6 +155,37 @@ def changeUserPassAPI(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
@csrf_exempt
|
||||
def submitUserDeletion(request):
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
adminUser = data['adminUser']
|
||||
adminPass = data['adminPass']
|
||||
|
||||
admin = Administrator.objects.get(userName=adminUser)
|
||||
|
||||
if admin.api == 0:
|
||||
data_ret = {"status": 0, 'error_message': "API Access Disabled."}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
if hashPassword.check_password(admin.password, adminPass):
|
||||
request.session['userID'] = admin.pk
|
||||
return duc(request)
|
||||
else:
|
||||
data_ret = {"status": 0,
|
||||
'error_message': "Could not authorize access to API"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException as msg:
|
||||
data_ret = {'submitUserDeletion': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
@csrf_exempt
|
||||
def changePackageAPI(request):
|
||||
try:
|
||||
@@ -189,8 +220,6 @@ def changePackageAPI(request):
|
||||
website.package = pack
|
||||
website.save()
|
||||
|
||||
|
||||
|
||||
data_ret = {'changePackage': 1, 'error_message': "None"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -622,4 +651,4 @@ def submitUserCreation(request):
|
||||
except BaseException as msg:
|
||||
data_ret = {'changeStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
@@ -244,7 +244,7 @@ if [[ $SERVER_COUNTRY == "CN" ]] ; then
|
||||
sed -i 's|wget http://rpms.litespeedtech.com/debian/|wget --no-check-certificate https://rpms.litespeedtech.com/debian/|g' install.py
|
||||
sed -i 's|https://repo.powerdns.com/repo-files/centos-auth-42.repo|https://'$DOWNLOAD_SERVER'/powerdns/powerdns.repo|g' installCyberPanel.py
|
||||
sed -i 's|https://www.rainloop.net/repository/webmail/rainloop-community-latest.zip|https://'$DOWNLOAD_SERVER'/misc/rainloop-community-latest.zip|g' install.py
|
||||
sed -i 's|rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm|curl -o /etc/yum.repos.d/litespeed.repo https://'$DOWNLOAD_SERVER'/litespeed/litespeed.repo|g' install.py
|
||||
sed -i 's|rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.2-1.el7.noarch.rpm|curl -o /etc/yum.repos.d/litespeed.repo https://'$DOWNLOAD_SERVER'/litespeed/litespeed.repo|g' install.py
|
||||
sed -i 's|https://copr.fedorainfracloud.org/coprs/copart/restic/repo/epel-7/copart-restic-epel-7.repo|https://'$DOWNLOAD_SERVER'/restic/restic.repo|g' install.py
|
||||
sed -i 's|yum -y install http://cyberpanel.sh/gf-release-latest.gf.el7.noarch.rpm|wget -O /etc/yum.repos.d/gf.repo https://'$DOWNLOAD_SERVER'/gf-plus/gf.repo|g' install.py
|
||||
sed -i 's|dovecot-2.3-latest|dovecot-2.3-latest-mirror|g' install.py
|
||||
@@ -369,11 +369,13 @@ fi
|
||||
|
||||
install_required() {
|
||||
|
||||
if [[ $CENTOS_8 == "True" ]] ; then
|
||||
curl https://raw.githubusercontent.com/usmannasir/cyberpanel/v2.0.1/install/CyberPanel8.repo > /etc/yum.repos.d/CyberPanel.repo
|
||||
dnf install zip -y
|
||||
elif [[ $CENTOS_8 == "False" ]] ; then
|
||||
curl https://raw.githubusercontent.com/usmannasir/cyberpanel/v2.0.1/install/CyberPanel.repo > /etc/yum.repos.d/CyberPanel.repo
|
||||
if [[ -d /etc/yum.repos.d ]] ; then
|
||||
if [[ $CENTOS_8 == "True" ]] ; then
|
||||
curl https://raw.githubusercontent.com/usmannasir/cyberpanel/v2.0.1/install/CyberPanel8.repo > /etc/yum.repos.d/CyberPanel.repo
|
||||
dnf install zip -y
|
||||
elif [[ $CENTOS_8 == "False" ]] ; then
|
||||
curl https://raw.githubusercontent.com/usmannasir/cyberpanel/v2.0.1/install/CyberPanel.repo > /etc/yum.repos.d/CyberPanel.repo
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "\nInstalling necessary components..."
|
||||
@@ -412,6 +414,7 @@ if [[ $SERVER_OS == "CentOS" ]] ; then
|
||||
check_return
|
||||
fi
|
||||
|
||||
|
||||
if [[ $SERVER_OS == "CentOS" ]] ; then
|
||||
pip3.6 install virtualenv==16.7.9
|
||||
else
|
||||
@@ -1575,4 +1578,4 @@ main_install
|
||||
|
||||
### Disable Centos Default Repos
|
||||
|
||||
disable_repos
|
||||
disable_repos
|
||||
|
||||
@@ -71,7 +71,9 @@ class cPanelImporter:
|
||||
self.PHPVersion = 'PHP 7.2'
|
||||
elif self.PHPVersion.find('73') > -1:
|
||||
self.PHPVersion = 'PHP 7.3'
|
||||
|
||||
elif self.PHPVersion.find('74') > -1:
|
||||
self.PHPVersion = 'PHP 7.4'
|
||||
|
||||
if self.PHPVersion == '':
|
||||
self.PHPVersion = 'PHP 7.1'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user