mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 05:15:49 +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)
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if ACLManager.checkOwnership(db[0].website.domain, admin, currentACL) == 1:
|
||||
pass
|
||||
else:
|
||||
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:
|
||||
data_ret = {'status': 0, 'changePasswordStatus': 0,'error_message': "Please see CyberPanel main log file."}
|
||||
|
||||
@@ -767,7 +767,7 @@ password=%s
|
||||
return 0
|
||||
|
||||
@staticmethod
|
||||
def changePassword(userName, dbPassword, encrypt = None):
|
||||
def changePassword(userName, dbPassword, encrypt = None, host = None):
|
||||
try:
|
||||
|
||||
connection, cursor = mysqlUtilities.setupConnection()
|
||||
@@ -776,6 +776,9 @@ password=%s
|
||||
return 0
|
||||
cursor.execute("use mysql")
|
||||
|
||||
if host != None:
|
||||
mysqlUtilities.LOCALHOST = host
|
||||
|
||||
if encrypt == None:
|
||||
try:
|
||||
dbuser = DBUsers.objects.get(user=userName)
|
||||
|
||||
Reference in New Issue
Block a user