mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 14:26:16 +01:00
db username
This commit is contained in:
@@ -215,6 +215,41 @@ class DatabaseManager:
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
def remoteAccess(self, userID = None, data = None):
|
||||||
|
try:
|
||||||
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
|
if ACLManager.currentContextPermission(currentACL, 'listDatabases') == 0:
|
||||||
|
return ACLManager.loadErrorJson('changePasswordStatus', 0)
|
||||||
|
|
||||||
|
userName = data['dbUserName']
|
||||||
|
dbPassword = data['dbPassword']
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
|
|
||||||
|
res = mysqlUtilities.changePassword(userName, dbPassword)
|
||||||
|
|
||||||
|
if res == 0:
|
||||||
|
data_ret = {'status': 0, 'changePasswordStatus': 0,'error_message': "Please see CyberPanel main log file."}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
data_ret = {'status': 1, 'changePasswordStatus': 1, 'error_message': "None"}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
except BaseException as msg:
|
||||||
|
data_ret = {'status': 0, 'changePasswordStatus': 0, 'error_message': str(msg)}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def generatePHPMYAdminData(userID):
|
def generatePHPMYAdminData(userID):
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -454,7 +454,11 @@ app.controller('listDBs', function ($scope, $http) {
|
|||||||
$scope.generatedPasswordView = true;
|
$scope.generatedPasswordView = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.remoteAccess = function () {
|
$scope.remoteAccess = function (userName) {
|
||||||
|
|
||||||
|
$scope.dbUsername = userName;
|
||||||
|
alert($scope.dbUsername);
|
||||||
|
return 0;
|
||||||
|
|
||||||
$scope.dbLoading = false;
|
$scope.dbLoading = false;
|
||||||
$scope.passwordChanged = true;
|
$scope.passwordChanged = true;
|
||||||
|
|||||||
@@ -119,7 +119,7 @@
|
|||||||
class="btn ra-100 btn-purple">{% trans "Change" %}</button>
|
class="btn ra-100 btn-purple">{% trans "Change" %}</button>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button ng-click="remoteAccess()" data-toggle="modal"
|
<button ng-click="remoteAccess(record.dbUser)" data-toggle="modal"
|
||||||
data-target="#remoteAccess" type="button"
|
data-target="#remoteAccess" type="button"
|
||||||
class="btn ra-100 btn-purple">{% trans "Manage" %}</button>
|
class="btn ra-100 btn-purple">{% trans "Manage" %}</button>
|
||||||
<div id="remoteAccess" class="modal fade" role="dialog">
|
<div id="remoteAccess" class="modal fade" role="dialog">
|
||||||
@@ -137,19 +137,24 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-12 control-label"
|
||||||
|
style="text-align: center;">{% trans "Contents of .gitignore, use the box below to Add/Edit content of .gitingore file." %}</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
<table style="margin-top: 2%" class="table">
|
<table style="margin-top: 2%" class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Type</th>
|
<th>Username</th>
|
||||||
<th>Date</th>
|
<th>Host</th>
|
||||||
<th>Message</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="log in logs track by $index">
|
<tr>
|
||||||
<td ng-bind="log.type"></td>
|
<td>{$ dbUsername $}</td>
|
||||||
<td ng-bind="log.date"></td>
|
<td></td>
|
||||||
<td ng-bind="log.message"></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -120,6 +120,17 @@ def changePassword(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
def remoteAccess(request):
|
||||||
|
try:
|
||||||
|
userID = request.session['userID']
|
||||||
|
|
||||||
|
dm = DatabaseManager()
|
||||||
|
coreResult = dm.remoteAccess(userID, json.loads(request.body))
|
||||||
|
|
||||||
|
return coreResult
|
||||||
|
except KeyError:
|
||||||
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
def phpMyAdmin(request):
|
def phpMyAdmin(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
|
|||||||
Reference in New Issue
Block a user