mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 21:35:55 +01:00
minor changes to backup manager
This commit is contained in:
@@ -74,12 +74,12 @@
|
||||
class="btn btn-primary">{% trans "Generate" %}</button>
|
||||
</div>
|
||||
|
||||
<label style="margin-top: 1%" class="col-sm-3 control-label">{% trans "Generated Password" %}</label>
|
||||
<div style="margin-top: 1%" class="col-sm-6">
|
||||
<label ng-hide="generatedPasswordView" style="margin-top: 1%" class="col-sm-3 control-label">{% trans "Generated Password" %}</label>
|
||||
<div ng-hide="generatedPasswordView" style="margin-top: 1%" class="col-sm-6">
|
||||
<input name="dom" type="text" class="form-control" ng-model="dbPassword" required>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 1%" class="col-sm-3">
|
||||
<div ng-hide="generatedPasswordView" style="margin-top: 1%" class="col-sm-3">
|
||||
<button type="button" ng-click="usePassword()"
|
||||
class="btn btn-primary">{% trans "Use" %}</button>
|
||||
</div>
|
||||
|
||||
@@ -92,13 +92,13 @@
|
||||
class="btn btn-primary">{% trans "Generate" %}</button>
|
||||
</div>
|
||||
|
||||
<label style="margin-top: 1%"
|
||||
<label ng-hide="generatedPasswordView" style="margin-top: 1%"
|
||||
class="col-sm-3 control-label">{% trans "Generated Password" %}</label>
|
||||
<div style="margin-top: 1%" class="col-sm-6">
|
||||
<div ng-hide="generatedPasswordView" style="margin-top: 1%" class="col-sm-6">
|
||||
<input name="dom" type="text" class="form-control" ng-model="ftpPassword" required>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 1%" class="col-sm-3">
|
||||
<div ng-hide="generatedPasswordView" style="margin-top: 1%" class="col-sm-3">
|
||||
<button type="button" ng-click="usePassword()"
|
||||
class="btn btn-primary">{% trans "Use" %}</button>
|
||||
</div>
|
||||
|
||||
@@ -207,10 +207,12 @@ class BackupManager:
|
||||
try:
|
||||
command = 'sudo rm -f ' + status
|
||||
cmd = shlex.split(command)
|
||||
res = subprocess.call(cmd)
|
||||
subprocess.call(cmd)
|
||||
|
||||
backupObs = Backups.objects.filter(fileName=fileName)
|
||||
for items in backupObs:
|
||||
items.delete()
|
||||
|
||||
backupOb = Backups.objects.get(fileName=fileName)
|
||||
backupOb.delete()
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [backupStatus]")
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ class backupSchedule:
|
||||
backupSchedule.remoteBackupLogging(backupLogPath, "")
|
||||
|
||||
except BaseException,msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [createBackup]")
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [backupSchedule.createBackup]")
|
||||
|
||||
@staticmethod
|
||||
def sendBackup(backupPath, IPAddress, backupLogPath , port):
|
||||
|
||||
@@ -125,6 +125,7 @@ class backupUtilities:
|
||||
## DNS Records XML
|
||||
|
||||
try:
|
||||
|
||||
dnsRecordsXML = Element("dnsrecords")
|
||||
dnsRecords = DNS.getDNSRecords(backupDomain)
|
||||
|
||||
@@ -144,8 +145,8 @@ class backupUtilities:
|
||||
|
||||
metaFileXML.append(dnsRecordsXML)
|
||||
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
except:
|
||||
pass
|
||||
|
||||
## Email accounts XML
|
||||
|
||||
@@ -166,8 +167,8 @@ class backupUtilities:
|
||||
|
||||
metaFileXML.append(emailRecordsXML)
|
||||
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
except:
|
||||
pass
|
||||
|
||||
## Email meta generated!
|
||||
|
||||
@@ -309,8 +310,8 @@ class backupUtilities:
|
||||
except:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startBackup]")
|
||||
|
||||
status = open(os.path.join(backupPath,'status'), "w")
|
||||
logging.CyberCPLogFileWriter.statusWriter(status, "Aborted, please check CyberPanel main log file. [5009]")
|
||||
status = os.path.join(backupPath,'status'), "w"
|
||||
logging.CyberCPLogFileWriter.statusWriter(status, "Aborted, "+ str(msg) + ". [5009]")
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startBackup]")
|
||||
|
||||
@staticmethod
|
||||
@@ -624,6 +625,7 @@ class backupUtilities:
|
||||
subprocess.call(cmd)
|
||||
|
||||
except BaseException, msg:
|
||||
status = os.path.join(completPath, 'status')
|
||||
logging.CyberCPLogFileWriter.statusWriter(status, str(msg) + " [5009]")
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startRestore]")
|
||||
|
||||
|
||||
@@ -22,6 +22,16 @@ function getCookie(name) {
|
||||
return cookieValue;
|
||||
}
|
||||
|
||||
function randomPassword(length) {
|
||||
var chars = "abcdefghijklmnopqrstuvwxyz!@#$%^*()-+<>ABCDEFGHIJKLMNOP1234567890";
|
||||
var pass = "";
|
||||
for (var x = 0; x < length; x++) {
|
||||
var i = Math.floor(Math.random() * chars.length);
|
||||
pass += chars.charAt(i);
|
||||
}
|
||||
return pass;
|
||||
}
|
||||
|
||||
/* Utilities ends here */
|
||||
|
||||
|
||||
|
||||
@@ -11,13 +11,13 @@ app.controller('createDatabase', function($scope,$http) {
|
||||
$scope.databaseCreationFailed = true;
|
||||
$scope.databaseCreated = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.generatedPasswordView = true;
|
||||
|
||||
|
||||
$scope.showDetailsBoxes = function(){
|
||||
$scope.dbDetails = false;
|
||||
};
|
||||
|
||||
|
||||
$scope.createDatabase = function(){
|
||||
|
||||
$scope.createDatabaseLoading = false;
|
||||
@@ -106,6 +106,15 @@ app.controller('createDatabase', function($scope,$http) {
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
$scope.generatePassword = function () {
|
||||
$scope.generatedPasswordView = false;
|
||||
$scope.dbPassword = randomPassword(12);
|
||||
};
|
||||
|
||||
$scope.usePassword = function () {
|
||||
$scope.generatedPasswordView = true;
|
||||
};
|
||||
|
||||
});
|
||||
@@ -365,8 +374,6 @@ app.controller('listDBs', function($scope,$http) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
function populateCurrentRecords(){
|
||||
$scope.recordsFetched = true;
|
||||
$scope.passwordChanged = true;
|
||||
@@ -442,6 +449,19 @@ app.controller('listDBs', function($scope,$http) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
////
|
||||
|
||||
$scope.generatedPasswordView = true;
|
||||
|
||||
$scope.generatePassword = function () {
|
||||
$scope.generatedPasswordView = false;
|
||||
$scope.dbPassword = randomPassword(12);
|
||||
};
|
||||
|
||||
$scope.usePassword = function () {
|
||||
$scope.generatedPasswordView = true;
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
@@ -23,8 +23,6 @@ app.controller('createFTPAccount', function($scope,$http) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
$scope.createFTPAccount = function(){
|
||||
|
||||
$scope.ftpLoading = false;
|
||||
@@ -116,6 +114,19 @@ app.controller('createFTPAccount', function($scope,$http) {
|
||||
|
||||
};
|
||||
|
||||
///
|
||||
|
||||
$scope.generatedPasswordView = true;
|
||||
|
||||
$scope.generatePassword = function () {
|
||||
$scope.generatedPasswordView = false;
|
||||
$scope.ftpPassword = randomPassword(12);
|
||||
};
|
||||
|
||||
$scope.usePassword = function () {
|
||||
$scope.generatedPasswordView = true;
|
||||
};
|
||||
|
||||
});
|
||||
/* Java script code to create account ends here */
|
||||
|
||||
@@ -142,8 +153,6 @@ app.controller('deleteFTPAccount', function($scope,$http) {
|
||||
$scope.deleteFTPButtonInit = true;
|
||||
|
||||
|
||||
|
||||
|
||||
var url = "/ftp/fetchFTPAccounts";
|
||||
|
||||
|
||||
@@ -382,8 +391,6 @@ app.controller('listFTPAccounts', function($scope,$http) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
function populateCurrentRecords(){
|
||||
$scope.recordsFetched = true;
|
||||
$scope.passwordChanged = true;
|
||||
@@ -459,6 +466,19 @@ app.controller('listFTPAccounts', function($scope,$http) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
////
|
||||
|
||||
$scope.generatedPasswordView = true;
|
||||
|
||||
$scope.generatePassword = function () {
|
||||
$scope.generatedPasswordView = false;
|
||||
$scope.ftpPassword = randomPassword(12);
|
||||
};
|
||||
|
||||
$scope.usePassword = function () {
|
||||
$scope.generatedPasswordView = true;
|
||||
};
|
||||
|
||||
});
|
||||
@@ -39,9 +39,6 @@ application.config(['$interpolateProvider',
|
||||
}
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
||||
application.controller('loginSystem', function($scope,$http,$window) {
|
||||
|
||||
|
||||
@@ -98,4 +95,3 @@ application.controller('loginSystem', function($scope,$http,$window) {
|
||||
|
||||
|
||||
/* Java script code to to Check Login status ends here */
|
||||
|
||||
|
||||
@@ -26,8 +26,6 @@ app.controller('createEmailAccount', function($scope,$http) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
$scope.createEmailAccount = function(){
|
||||
|
||||
$scope.emailDetails = false;
|
||||
@@ -117,11 +115,21 @@ app.controller('createEmailAccount', function($scope,$http) {
|
||||
|
||||
};
|
||||
|
||||
$scope.generatedPasswordView = true;
|
||||
|
||||
$scope.generatePassword = function () {
|
||||
$scope.generatedPasswordView = false;
|
||||
$scope.emailPassword = randomPassword(12);
|
||||
};
|
||||
|
||||
$scope.usePassword = function () {
|
||||
$scope.generatedPasswordView = true;
|
||||
};
|
||||
|
||||
});
|
||||
/* Java script code to create account ends here */
|
||||
|
||||
|
||||
|
||||
/* Java script code to create account */
|
||||
app.controller('deleteEmailAccount', function($scope,$http) {
|
||||
|
||||
@@ -318,7 +326,6 @@ app.controller('deleteEmailAccount', function($scope,$http) {
|
||||
/* Java script code to create account ends here */
|
||||
|
||||
|
||||
|
||||
/* Java script code to create account */
|
||||
app.controller('changeEmailPassword', function($scope,$http) {
|
||||
|
||||
@@ -408,7 +415,6 @@ app.controller('changeEmailPassword', function($scope,$http) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
$scope.changePassword = function(){
|
||||
|
||||
$scope.emailLoading = false;
|
||||
@@ -493,8 +499,6 @@ app.controller('changeEmailPassword', function($scope,$http) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
$scope.deleteEmailAccount = function(){
|
||||
|
||||
var domain = $scope.selectedEmail;
|
||||
@@ -505,6 +509,21 @@ app.controller('changeEmailPassword', function($scope,$http) {
|
||||
|
||||
};
|
||||
|
||||
///
|
||||
|
||||
$scope.generatedPasswordView = true;
|
||||
|
||||
$scope.generatePassword = function () {
|
||||
$scope.generatedPasswordView = false;
|
||||
$scope.emailPassword = randomPassword(12);
|
||||
};
|
||||
|
||||
$scope.usePassword = function () {
|
||||
$scope.generatedPasswordView = true;
|
||||
};
|
||||
|
||||
|
||||
|
||||
});
|
||||
/* Java script code to create account ends here */
|
||||
|
||||
|
||||
@@ -108,7 +108,6 @@ app.controller('createUserCtr', function($scope,$http) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
$scope.hideSomeThings = function(){
|
||||
|
||||
$scope.userCreated = true;
|
||||
@@ -117,6 +116,19 @@ app.controller('createUserCtr', function($scope,$http) {
|
||||
|
||||
};
|
||||
|
||||
///
|
||||
|
||||
$scope.generatedPasswordView = true;
|
||||
|
||||
$scope.generatePassword = function () {
|
||||
$scope.generatedPasswordView = false;
|
||||
$scope.password = randomPassword(12);
|
||||
};
|
||||
|
||||
$scope.usePassword = function () {
|
||||
$scope.generatedPasswordView = true;
|
||||
};
|
||||
|
||||
});
|
||||
/* Java script code to create account ends here */
|
||||
|
||||
@@ -333,7 +345,6 @@ app.controller('modifyUser', function($scope,$http) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
$scope.showLimitsBox = function () {
|
||||
|
||||
if ($scope.accountType == "Normal User"){
|
||||
@@ -353,6 +364,19 @@ app.controller('modifyUser', function($scope,$http) {
|
||||
|
||||
};
|
||||
|
||||
///
|
||||
|
||||
$scope.generatedPasswordView = true;
|
||||
|
||||
$scope.generatePassword = function () {
|
||||
$scope.generatedPasswordView = false;
|
||||
$scope.password = randomPassword(12);
|
||||
};
|
||||
|
||||
$scope.usePassword = function () {
|
||||
$scope.generatedPasswordView = true;
|
||||
};
|
||||
|
||||
});
|
||||
/* Java script code to modify user account ends here */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user