mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 22:06:05 +01:00
fix password protection backend
This commit is contained in:
@@ -1994,19 +1994,19 @@ class WebsiteManager:
|
|||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
htpasswd = f'{path}/.htpasswd'
|
htpasswd = f'{path}/.htpasswd'
|
||||||
htaccess = f'{wpsite.path}/.htaccess'
|
htaccess = f'{wpsite.path}/.htaccess'
|
||||||
password = randomPassword.generate_pass(12)
|
password = randomPassword.generate_pass(12)
|
||||||
|
|
||||||
# Create .htpasswd file
|
# Create .htpasswd file
|
||||||
command = f"htpasswd -cb {htpasswd} admin {password}"
|
command = f"htpasswd -cb {htpasswd} admin {password}"
|
||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
# Create .htaccess file
|
# Create .htaccess file
|
||||||
htaccess_content = f"""AuthType Basic
|
htaccess_content = f"""AuthType Basic
|
||||||
AuthName "Restricted Access"
|
AuthName "Restricted Access"
|
||||||
AuthUserFile {htpasswd}
|
AuthUserFile {htpasswd}
|
||||||
Require valid-user"""
|
Require valid-user"""
|
||||||
with open(htaccess, 'w') as f:
|
with open(htaccess, 'w') as f:
|
||||||
f.write(htaccess_content)
|
f.write(htaccess_content)
|
||||||
else:
|
else:
|
||||||
# Disable password protection
|
# Disable password protection
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
@@ -2208,7 +2208,7 @@ Require valid-user"""
|
|||||||
if alias == 0:
|
if alias == 0:
|
||||||
phpSelection = data['phpSelection']
|
phpSelection = data['phpSelection']
|
||||||
path = data['path']
|
path = data['path']
|
||||||
else:
|
else:
|
||||||
|
|
||||||
### if master website have apache then create this sub-domain also as ols + apache
|
### if master website have apache then create this sub-domain also as ols + apache
|
||||||
|
|
||||||
@@ -2711,7 +2711,7 @@ Require valid-user"""
|
|||||||
for items in childDomains:
|
for items in childDomains:
|
||||||
confPath = virtualHostUtilities.Server_root + "/conf/vhosts/" + items.domain
|
confPath = virtualHostUtilities.Server_root + "/conf/vhosts/" + items.domain
|
||||||
command = "mv " + confPath + " " + confPath + "-suspended"
|
command = "mv " + confPath + " " + confPath + "-suspended"
|
||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
installUtilities.reStartLiteSpeedSocket()
|
installUtilities.reStartLiteSpeedSocket()
|
||||||
website.state = 0
|
website.state = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user