mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-15 17:56:12 +01:00
bug fix: phpmyadmin auto login when no db exists
This commit is contained in:
@@ -197,12 +197,11 @@ def generateAccess(request):
|
|||||||
token=token).save()
|
token=token).save()
|
||||||
|
|
||||||
sites = ACLManager.findWebsiteObjects(currentACL, userID)
|
sites = ACLManager.findWebsiteObjects(currentACL, userID)
|
||||||
createUser = 1
|
mysqlUtilities.addUserToDB(None, None, None, 1)
|
||||||
|
|
||||||
for site in sites:
|
for site in sites:
|
||||||
for db in site.databases_set.all():
|
for db in site.databases_set.all():
|
||||||
mysqlUtilities.addUserToDB(db.dbName, admin.userName, password, createUser)
|
mysqlUtilities.addUserToDB(db.dbName, admin.userName, password, 0)
|
||||||
createUser = 0
|
|
||||||
|
|
||||||
data_ret = {'status': 1, 'token': token, 'username': admin.userName}
|
data_ret = {'status': 1, 'token': token, 'username': admin.userName}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
@@ -242,12 +241,9 @@ def fetchDetailsPHPMYAdmin(request):
|
|||||||
|
|
||||||
sites = ACLManager.findWebsiteObjects(currentACL, userID)
|
sites = ACLManager.findWebsiteObjects(currentACL, userID)
|
||||||
|
|
||||||
createUser = 0
|
|
||||||
|
|
||||||
for site in sites:
|
for site in sites:
|
||||||
for db in site.databases_set.all():
|
for db in site.databases_set.all():
|
||||||
mysqlUtilities.addUserToDB(db.dbName, admin.userName, password.decode(), createUser)
|
mysqlUtilities.addUserToDB(db.dbName, admin.userName, password.decode(), 0)
|
||||||
createUser = 0
|
|
||||||
|
|
||||||
returnURL = '/phpmyadmin/phpmyadminsignin.php?username=%s&password=%s' % (admin.userName, password.decode())
|
returnURL = '/phpmyadmin/phpmyadminsignin.php?username=%s&password=%s' % (admin.userName, password.decode())
|
||||||
return redirect(returnURL)
|
return redirect(returnURL)
|
||||||
|
|||||||
@@ -938,6 +938,8 @@ skip-name-resolve
|
|||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile('%s [addUserToDB:943]' % (str(msg)))
|
logging.CyberCPLogFileWriter.writeToFile('%s [addUserToDB:943]' % (str(msg)))
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
if mysqlUtilities.RDS == 0:
|
if mysqlUtilities.RDS == 0:
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"GRANT ALL PRIVILEGES ON " + database + ".* TO '" + user + "'@'%s'" % (mysqlUtilities.LOCALHOST))
|
"GRANT ALL PRIVILEGES ON " + database + ".* TO '" + user + "'@'%s'" % (mysqlUtilities.LOCALHOST))
|
||||||
|
|||||||
Reference in New Issue
Block a user