mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 13:25:51 +01:00
bug fix: change password when remote access enabled
This commit is contained in:
@@ -195,13 +195,19 @@ class DatabaseManager:
|
|||||||
db = Databases.objects.filter(dbUser=userName)
|
db = Databases.objects.filter(dbUser=userName)
|
||||||
|
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
if ACLManager.checkOwnership(db[0].website.domain, admin, currentACL) == 1:
|
if ACLManager.checkOwnership(db[0].website.domain, admin, currentACL) == 1:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
return ACLManager.loadErrorJson()
|
return ACLManager.loadErrorJson()
|
||||||
|
|
||||||
|
try:
|
||||||
|
meta = DBMeta.objects.get(database=db[0], key=DatabaseManager.REMOTE_ACCESS)
|
||||||
|
host = json.loads(meta.value)['remoteIP']
|
||||||
|
except:
|
||||||
|
host = None
|
||||||
|
|
||||||
res = mysqlUtilities.changePassword(userName, dbPassword)
|
res = mysqlUtilities.changePassword(userName, dbPassword, None, host)
|
||||||
|
|
||||||
if res == 0:
|
if res == 0:
|
||||||
data_ret = {'status': 0, 'changePasswordStatus': 0,'error_message': "Please see CyberPanel main log file."}
|
data_ret = {'status': 0, 'changePasswordStatus': 0,'error_message': "Please see CyberPanel main log file."}
|
||||||
|
|||||||
@@ -767,7 +767,7 @@ password=%s
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def changePassword(userName, dbPassword, encrypt = None):
|
def changePassword(userName, dbPassword, encrypt = None, host = None):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
connection, cursor = mysqlUtilities.setupConnection()
|
connection, cursor = mysqlUtilities.setupConnection()
|
||||||
@@ -776,6 +776,9 @@ password=%s
|
|||||||
return 0
|
return 0
|
||||||
cursor.execute("use mysql")
|
cursor.execute("use mysql")
|
||||||
|
|
||||||
|
if host != None:
|
||||||
|
mysqlUtilities.LOCALHOST = host
|
||||||
|
|
||||||
if encrypt == None:
|
if encrypt == None:
|
||||||
try:
|
try:
|
||||||
dbuser = DBUsers.objects.get(user=userName)
|
dbuser = DBUsers.objects.get(user=userName)
|
||||||
|
|||||||
Reference in New Issue
Block a user