Temporary_Domain_Features

This commit is contained in:
jojkhan
2022-11-16 13:47:30 +05:00
parent 6857912f39
commit 903b12d5f8
5 changed files with 434 additions and 39 deletions

View File

@@ -18,6 +18,7 @@ function getCookie(name) {
return cookieValue; return cookieValue;
} }
var arry = [] var arry = []
function selectpluginJs(val) { function selectpluginJs(val) {
@@ -252,6 +253,28 @@ app.controller('WPAddNewPlugin', function ($scope, $http, $timeout, $window, $co
}); });
var domain_check = 0;
function checkbox_function() {
var checkBox = document.getElementById("myCheck");
// Get the output text
// If the checkbox is checked, display the output text
if (checkBox.checked == true) {
domain_check = 0;
document.getElementById('Test_Domain').style.display= "block";
document.getElementById('Own_Domain').style.display = "none";
} else {
document.getElementById('Test_Domain').style.display = "none";
document.getElementById('Own_Domain').style.display = "block";
domain_check = 1;
}
// alert(domain_check);
}
app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $window) { app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $window) {
$scope.webSiteCreationLoading = true; $scope.webSiteCreationLoading = true;
@@ -262,6 +285,7 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $
$scope.couldNotConnect = true; $scope.couldNotConnect = true;
$scope.goBackDisable = true; $scope.goBackDisable = true;
var statusFile; var statusFile;
$scope.createWordPresssite = function () { $scope.createWordPresssite = function () {
@@ -280,7 +304,17 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $
var package = $scope.packageForWebsite; var package = $scope.packageForWebsite;
var websiteOwner = $scope.websiteOwner; var websiteOwner = $scope.websiteOwner;
var WPtitle = $scope.WPtitle; var WPtitle = $scope.WPtitle;
var domainNameCreate = $scope.domainNameCreate;
if (domain_check == 0) {
var Part2_domainNameCreate = document.getElementById('Part2_domainNameCreate').value;
var domainNameCreate = document.getElementById('TestDomainNameCreate').value + Part2_domainNameCreate;
}
if (domain_check == 1) {
var domainNameCreate = $scope.own_domainNameCreate;
}
var WPUsername = $scope.WPUsername; var WPUsername = $scope.WPUsername;
var adminEmail = $scope.adminEmail; var adminEmail = $scope.adminEmail;
var WPPassword = $scope.WPPassword; var WPPassword = $scope.WPPassword;
@@ -290,14 +324,25 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $
var pluginupdates = $scope.pluginupdates; var pluginupdates = $scope.pluginupdates;
var themeupdates = $scope.themeupdates; var themeupdates = $scope.themeupdates;
if (domain_check == 0) {
var path = "";
}
if (domain_check = 1) {
var path = $scope.installPath; var path = $scope.installPath;
}
var home = "1"; var home = "1";
if (typeof path != 'undefined') { if (typeof path != 'undefined') {
home = "0"; home = "0";
} }
alert(domainNameCreate);
var data = { var data = {
title: WPtitle, title: WPtitle,
@@ -315,6 +360,7 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $
home: home, home: home,
path: path, path: path,
} }
var config = { var config = {
headers: { headers: {
'X-CSRFToken': getCookie('csrftoken') 'X-CSRFToken': getCookie('csrftoken')
@@ -2278,6 +2324,29 @@ app.controller('BackupSchedule', function ($scope, $http, $timeout, $window) {
}; };
}); });
/* Java script code to create account */ /* Java script code to create account */
var website_create_domain_check = 0;
function website_create_checkbox_function() {
var checkBox = document.getElementById("myCheck");
// Get the output text
// If the checkbox is checked, display the output text
if (checkBox.checked == true) {
website_create_domain_check = 0;
document.getElementById('Website_Create_Test_Domain').style.display= "block";
document.getElementById('Website_Create_Own_Domain').style.display = "none";
} else {
document.getElementById('Website_Create_Test_Domain').style.display = "none";
document.getElementById('Website_Create_Own_Domain').style.display = "block";
website_create_domain_check = 1;
}
// alert(domain_check);
}
app.controller('createWebsite', function ($scope, $http, $timeout, $window) { app.controller('createWebsite', function ($scope, $http, $timeout, $window) {
$scope.webSiteCreationLoading = true; $scope.webSiteCreationLoading = true;
@@ -2332,7 +2401,18 @@ app.controller('createWebsite', function ($scope, $http, $timeout, $window) {
url = "/websites/submitWebsiteCreation"; url = "/websites/submitWebsiteCreation";
var package = $scope.packageForWebsite; var package = $scope.packageForWebsite;
var domainName = $scope.domainNameCreate;
if (website_create_domain_check == 0) {
var Part2_domainNameCreate = document.getElementById('Part2_domainNameCreate').value;
var domainName = document.getElementById('TestDomainNameCreate').value + Part2_domainNameCreate;
}
if (website_create_domain_check == 1) {
var domainName = $scope.own_domainNameCreate;
}
// var domainName = $scope.domainNameCreate;
var adminEmail = $scope.adminEmail; var adminEmail = $scope.adminEmail;
var phpSelection = $scope.phpSelection; var phpSelection = $scope.phpSelection;
var websiteOwner = $scope.websiteOwner; var websiteOwner = $scope.websiteOwner;
@@ -2647,9 +2727,7 @@ app.controller('listWebsites', function ($scope, $http) {
var url = "/websites/ScanWordpressSite"; var url = "/websites/ScanWordpressSite";
var data = { var data = {}
}
var config = { var config = {

View File

@@ -6,6 +6,61 @@
{% load static %} {% load static %}
{% get_current_language as LANGUAGE_CODE %} {% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} --> <!-- Current language: {{ LANGUAGE_CODE }} -->
<style>
.switch {
margin-top: 7px;
margin-left: 12px;
position: relative;
display: inline-block;
width: 32px;
height: 19px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 11px;
width: 12px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(12px);
-ms-transform: translateX(12px);
transform: translateX(12px);
}
</style>
<div class="container"> <div class="container">
<div id="page-title"> <div id="page-title">
@@ -14,6 +69,7 @@
</div> </div>
<div ng-controller="createWordpress" class="panel"> <div ng-controller="createWordpress" class="panel">
<div class="panel-body"> <div class="panel-body">
<h3 class="content-box-header"> <h3 class="content-box-header">
@@ -54,15 +110,62 @@
</div> </div>
{# <div ng-hide="installationDetailsForm" class="form-group">#} {# <div ng-hide="installationDetailsForm" class="form-group">#}
{# <label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>#} {# <label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>#}
{# <div class="col-sm-6">#} {# <div class="col-sm-6">#}
{# <input name="dom" type="text" class="form-control" ng-model="domainNameCreate"#} {# <input name="dom" type="text" class="form-control" ng-model="domainNameCreate"#}
{# placeholder="{% trans "Do not enter WWW, it will be auto created!" %}" required>#} {# placeholder="{% trans "Do not enter WWW, it will be auto created!" %}" required>#}
{# </div>#} {# </div>#}
{# <div ng-show="websiteCreationForm.dom.$error.pattern"#} {# <div ng-show="websiteCreationForm.dom.$error.pattern"#}
{# class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div>#} {# class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div>#}
{# </div>#} {# </div>#}
{# My Work #}
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label" style="margin-bottom: 15px">{% trans "Test Domain" %}</label>
<label class="switch my-3">
<input type="checkbox" checked id="myCheck" onclick="checkbox_function()" style="margin-top: 10px">
<span class="slider"></span>
</label>
<br><br>
<div id="Test_Domain" class="tabcontent" style="border: none;margin-left: 10px">
<div ng-hide="installationDetailsForm" class="form-group"
ng-if="{{ test_domain_data }} == 1 ">
<label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>
<div class="col-sm-6">
<div class="input-group bootstrap-touchspin">
<span
class="input-group-addon bootstrap-touchspin-prefix"
style="display: none;"></span>
<input id="TestDomainNameCreate"
class="form-control"
type="text" value=""
name="touchspin-demo-1"
style="display: block;"
placeholder="{% trans "Enter Subdomain Here" %}">
<span style="width: 48%" class="input-group-btn">
<input id="Part2_domainNameCreate" class="form-control"
type="text" name="Part2_domainNameCreate"
style="display: block;color: black;font-weight: bold;color: black;opacity: 1"
placeholder=".{{ Randam_String }}.cyberpanel.website"
value=".{{ Randam_String }}.cyberpanel.website" readonly></span>
</div>
</div>
<div ng-show="websiteCreationForm.dom.$error.pattern"
class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div>
</div>
<div ng-if="{{ test_domain_data }} == 0 ">
<center>Looks like you have not subscripted to temporary domain feature,<a href="https://go.cyberpanel.net/TempDomain">click here</a>
for more details.
</center>
</div>
</div>
<div id="Own_Domain" class="tabcontent" style="border: none;display: none;margin-left: 10px">
<div ng-hide="installationDetailsForm" class="form-group"> <div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Domain Name" %}</label> <label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>
@@ -71,10 +174,12 @@
<span <span
class="input-group-addon bootstrap-touchspin-prefix" class="input-group-addon bootstrap-touchspin-prefix"
style="display: none;"></span> style="display: none;"></span>
<input ng-model="domainNameCreate" id="touchspin-demo-1" class="form-control" <input ng-model="own_domainNameCreate" id="touchspin-demo-1"
type="text" value="55" class="form-control"
type="text" value=""
name="touchspin-demo-1" name="touchspin-demo-1"
style="display: block;" placeholder="{% trans "Do not enter WWW, it will be auto created!" %}"> style="display: block;"
placeholder="{% trans "Do not enter WWW, it will be auto created!" %}">
<span class="input-group-addon bootstrap-touchspin-postfix">/</span> <span class="input-group-addon bootstrap-touchspin-postfix">/</span>
<span style="width: 25%" class="input-group-btn"> <span style="width: 25%" class="input-group-btn">
<input id="touchspin-demo-1" class="form-control" <input id="touchspin-demo-1" class="form-control"
@@ -86,8 +191,11 @@
<div ng-show="websiteCreationForm.dom.$error.pattern" <div ng-show="websiteCreationForm.dom.$error.pattern"
class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div> class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div>
</div> </div>
</div>
</div>
{# My Work End#}
{# #}
<div ng-hide="installationDetailsForm" class="form-group"> <div ng-hide="installationDetailsForm" 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">

View File

@@ -6,6 +6,61 @@
{% load static %} {% load static %}
{% get_current_language as LANGUAGE_CODE %} {% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} --> <!-- Current language: {{ LANGUAGE_CODE }} -->
<style>
.switch {
margin-top: 7px;
margin-left: 12px;
position: relative;
display: inline-block;
width: 32px;
height: 19px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 11px;
width: 12px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(12px);
-ms-transform: translateX(12px);
transform: translateX(12px);
}
</style>
<div class="container"> <div class="container">
<div id="page-title"> <div id="page-title">
@@ -14,6 +69,7 @@
</div> </div>
<div ng-controller="createWebsite" class="panel"> <div ng-controller="createWebsite" class="panel">
<div class="panel-body"> <div class="panel-body">
<h3 class="content-box-header"> <h3 class="content-box-header">
@@ -47,15 +103,77 @@
</div> </div>
</div> </div>
{# My Work #}
<div ng-hide="installationDetailsForm" class="form-group"> <div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label" style="margin-bottom: 15px">{% trans "Test Domain" %}</label>
<label class="switch my-3">
<input type="checkbox" checked id="myCheck" onclick="website_create_checkbox_function()" style="margin-top: 10px">
<span class="slider"></span>
</label>
<br><br>
<div id="Website_Create_Test_Domain" class="tabcontent" style="border: none;margin-left: 10px">
<div ng-hide="installationDetailsForm" class="form-group"
ng-if="{{ test_domain_data }} == 1 ">
<label class="col-sm-3 control-label">{% trans "Domain Name" %}</label> <label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input name="dom" type="text" class="form-control" ng-model="domainNameCreate" <div class="input-group bootstrap-touchspin">
placeholder="{% trans "Do not enter WWW, it will be auto created!" %}" required> <span
class="input-group-addon bootstrap-touchspin-prefix"
style="display: none;"></span>
<input id="TestDomainNameCreate"
class="form-control"
type="text" value=""
name="touchspin-demo-1"
style="display: block;"
placeholder="{% trans "Enter Subdomain Here" %}">
<span style="width: 48%" class="input-group-btn">
<input id="Part2_domainNameCreate" class="form-control"
type="text" name="Part2_domainNameCreate"
style="display: block;color: black;font-weight: bold;color: black;opacity: 1"
placeholder=".{{ Randam_String }}.cyberpanel.website"
value=".{{ Randam_String }}.cyberpanel.website" readonly></span>
</div>
</div> </div>
<div ng-show="websiteCreationForm.dom.$error.pattern" <div ng-show="websiteCreationForm.dom.$error.pattern"
class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div> class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div>
</div> </div>
<div ng-if="{{ test_domain_data }} == 0 ">
<center>Looks like you have not subscripted to temporary domain feature, <a href="https://go.cyberpanel.net/TempDomain">click here</a>
for more details.
</center>
</div>
</div>
<div id="Website_Create_Own_Domain" class="tabcontent" style="border: none;display: none;margin-left: 10px">
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>
<div class="col-sm-6">
<div class="input-group bootstrap-touchspin">
<span
class="input-group-addon bootstrap-touchspin-prefix"
style="display: none;"></span>
<input ng-model="own_domainNameCreate" id="touchspin-demo-1"
class="form-control"
type="text" value=""
name="touchspin-demo-1"
style="display: block;"
placeholder="{% trans "Do not enter WWW, it will be auto created!" %}">
<span style="width: 25%" class="input-group-btn">
</span></div>
</div>
<div ng-show="websiteCreationForm.dom.$error.pattern"
class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div>
</div>
</div>
</div>
{# My Work End#}
{# #}
<div ng-hide="installationDetailsForm" class="form-group"> <div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Email" %}</label> <label class="col-sm-3 control-label">{% trans "Email" %}</label>

View File

@@ -33,7 +33,7 @@ def WPCreate(request):
try: try:
userID = request.session['userID'] userID = request.session['userID']
wm = WebsiteManager() wm = WebsiteManager()
return wm.WPCreate(request, userID) return wm.WPCreate(request, userID,)
except KeyError: except KeyError:
return redirect(loadLoginPage) return redirect(loadLoginPage)

View File

@@ -52,12 +52,25 @@ class WebsiteManager:
self.childDomain = childDomain self.childDomain = childDomain
def createWebsite(self, request=None, userID=None, data=None): def createWebsite(self, request=None, userID=None, data=None):
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
test_domain_data = {
"name": "test-domain",
"IP": ACLManager.GetServerIP(),
}
import requests
response = requests.post(url, data=json.dumps(test_domain_data))
test_domain_status = response.json()['status']
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)
adminNames = ACLManager.loadAllUsers(userID) adminNames = ACLManager.loadAllUsers(userID)
packagesName = ACLManager.loadPackages(userID, currentACL) packagesName = ACLManager.loadPackages(userID, currentACL)
phps = PHPManager.findPHPVersions() phps = PHPManager.findPHPVersions()
Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps} rnpss = randomPassword.generate_pass(10)
Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps,'Randam_String': rnpss.lower(), 'test_domain_data': test_domain_status}
proc = httpProc(request, 'websiteFunctions/createWebsite.html', proc = httpProc(request, 'websiteFunctions/createWebsite.html',
Data, 'createWebsite') Data, 'createWebsite')
return proc.render() return proc.render()
@@ -68,6 +81,17 @@ class WebsiteManager:
"name": "wp-manager", "name": "wp-manager",
"IP": ACLManager.GetServerIP() "IP": ACLManager.GetServerIP()
} }
test_domain_data = {
"name": "test-domain",
"IP": ACLManager.GetServerIP(),
}
import requests
response = requests.post(url, data=json.dumps(test_domain_data))
test_domain_status = response.json()['status']
import requests import requests
response = requests.post(url, data=json.dumps(data)) response = requests.post(url, data=json.dumps(data))
@@ -94,8 +118,9 @@ class WebsiteManager:
FinalVersions = ['5.6', '5.5.3', '5.5.2'] FinalVersions = ['5.6', '5.5.3', '5.5.2']
Plugins = wpplugins.objects.filter(owner=userobj) Plugins = wpplugins.objects.filter(owner=userobj)
rnpss = randomPassword.generate_pass(10)
Data = {'packageList': packagesName, "owernList": adminNames, 'WPVersions': FinalVersions, 'Plugins': Plugins } Data = {'packageList': packagesName, "owernList": adminNames, 'WPVersions': FinalVersions, 'Plugins': Plugins,'Randam_String': rnpss.lower(), 'test_domain_data': test_domain_status}
proc = httpProc(request, 'websiteFunctions/WPCreate.html', proc = httpProc(request, 'websiteFunctions/WPCreate.html',
Data, 'createWebsite') Data, 'createWebsite')
return proc.render() return proc.render()
@@ -2021,6 +2046,27 @@ class WebsiteManager:
admin = Administrator.objects.get(pk=userID) admin = Administrator.objects.get(pk=userID)
if data['domain'].find("cyberpanel.website") > -1:
url = "https://platform.cyberpersons.com/CyberpanelAdOns/CreateDomain"
domain_data = {
"name": "test-domain",
"IP": ACLManager.GetServerIP(),
"domain": data['domain']
}
import requests
response = requests.post(url, data=json.dumps(domain_data))
domain_status = response.json()['status']
if domain_status == 0:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': response.json()['error_message']}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
extraArgs = {} extraArgs = {}
extraArgs['currentACL'] = currentACL extraArgs['currentACL'] = currentACL
extraArgs['adminID'] = admin.pk extraArgs['adminID'] = admin.pk
@@ -2075,6 +2121,24 @@ class WebsiteManager:
packageName = data['package'] packageName = data['package']
websiteOwner = data['websiteOwner'].lower() websiteOwner = data['websiteOwner'].lower()
if data['domainName'].find("cyberpanel.website") > -1:
url = "https://platform.cyberpersons.com/CyberpanelAdOns/CreateDomain"
domain_data = {
"name": "test-domain",
"IP": ACLManager.GetServerIP(),
"domain": data['domainName']
}
import requests
response = requests.post(url, data=json.dumps(domain_data))
domain_status = response.json()['status']
if domain_status == 0:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': response.json()['error_message']}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
loggedUser = Administrator.objects.get(pk=userID) loggedUser = Administrator.objects.get(pk=userID)
newOwner = Administrator.objects.get(userName=websiteOwner) newOwner = Administrator.objects.get(userName=websiteOwner)
@@ -2433,6 +2497,18 @@ class WebsiteManager:
def submitWebsiteDeletion(self, userID=None, data=None): def submitWebsiteDeletion(self, userID=None, data=None):
try: try:
if data['websiteName'].find("cyberpanel.website") > -1:
url = "https://platform.cyberpersons.com/CyberpanelAdOns/DeleteDomain"
domain_data = {
"name": "test-domain",
"IP": ACLManager.GetServerIP(),
"domain": data['websiteName']
}
import requests
response = requests.post(url, data=json.dumps(domain_data))
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)
if ACLManager.currentContextPermission(currentACL, 'deleteWebsite') == 0: if ACLManager.currentContextPermission(currentACL, 'deleteWebsite') == 0:
@@ -2464,10 +2540,25 @@ class WebsiteManager:
def submitDomainDeletion(self, userID=None, data=None): def submitDomainDeletion(self, userID=None, data=None):
try: try:
if data['websiteName'].find("cyberpanel.website") > -1:
url = "https://platform.cyberpersons.com/CyberpanelAdOns/DeleteDomain"
domain_data = {
"name": "test-domain",
"IP": ACLManager.GetServerIP(),
"domain": data['websiteName']
}
import requests
response = requests.post(url, data=json.dumps(domain_data))
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID) admin = Administrator.objects.get(pk=userID)
websiteName = data['websiteName'] websiteName = data['websiteName']
try: try:
DeleteDocRoot = int(data['DeleteDocRoot']) DeleteDocRoot = int(data['DeleteDocRoot'])
except: except: