mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-13 08:46:09 +01:00
bug fix: apply token of correct password
This commit is contained in:
@@ -807,6 +807,10 @@ class IncJobs(multi.Thread):
|
|||||||
if self.backupDestinations == 'local':
|
if self.backupDestinations == 'local':
|
||||||
command = 'restic init --repo %s --password-file %s' % (self.repoPath, self.passwordFile)
|
command = 'restic init --repo %s --password-file %s' % (self.repoPath, self.passwordFile)
|
||||||
result = ProcessUtilities.outputExecutioner(command)
|
result = ProcessUtilities.outputExecutioner(command)
|
||||||
|
|
||||||
|
if os.path.exists(ProcessUtilities.debugPath):
|
||||||
|
logging.writeToFile(result)
|
||||||
|
|
||||||
if result.find('config file already exists') == -1:
|
if result.find('config file already exists') == -1:
|
||||||
logging.statusWriter(self.statusPath, result, 1)
|
logging.statusWriter(self.statusPath, result, 1)
|
||||||
|
|
||||||
@@ -815,6 +819,10 @@ class IncJobs(multi.Thread):
|
|||||||
command = 'export PATH=${PATH}:/usr/bin && restic init --repo %s:%s --password-file %s' % (
|
command = 'export PATH=${PATH}:/usr/bin && restic init --repo %s:%s --password-file %s' % (
|
||||||
self.backupDestinations, remotePath, self.passwordFile)
|
self.backupDestinations, remotePath, self.passwordFile)
|
||||||
result = ProcessUtilities.outputExecutioner(command)
|
result = ProcessUtilities.outputExecutioner(command)
|
||||||
|
|
||||||
|
if os.path.exists(ProcessUtilities.debugPath):
|
||||||
|
logging.writeToFile(result)
|
||||||
|
|
||||||
if result.find('config file already exists') == -1:
|
if result.find('config file already exists') == -1:
|
||||||
logging.statusWriter(self.statusPath, result, 1)
|
logging.statusWriter(self.statusPath, result, 1)
|
||||||
else:
|
else:
|
||||||
@@ -822,9 +830,12 @@ class IncJobs(multi.Thread):
|
|||||||
command = 'export AWS_ACCESS_KEY_ID=%s AWS_SECRET_ACCESS_KEY=%s && restic -r s3:s3.amazonaws.com/%s init --password-file %s' % (
|
command = 'export AWS_ACCESS_KEY_ID=%s AWS_SECRET_ACCESS_KEY=%s && restic -r s3:s3.amazonaws.com/%s init --password-file %s' % (
|
||||||
key, secret, self.website.domain, self.passwordFile)
|
key, secret, self.website.domain, self.passwordFile)
|
||||||
result = ProcessUtilities.outputExecutioner(command)
|
result = ProcessUtilities.outputExecutioner(command)
|
||||||
|
|
||||||
|
if os.path.exists(ProcessUtilities.debugPath):
|
||||||
|
logging.writeToFile(result)
|
||||||
|
|
||||||
if result.find('config file already exists') == -1:
|
if result.find('config file already exists') == -1:
|
||||||
logging.statusWriter(self.statusPath, result, 1)
|
logging.statusWriter(self.statusPath, result, 1)
|
||||||
return 1
|
|
||||||
|
|
||||||
logging.statusWriter(self.statusPath,
|
logging.statusWriter(self.statusPath,
|
||||||
'Repo %s initiated for %s.' % (self.backupDestinations, self.website.domain), 1)
|
'Repo %s initiated for %s.' % (self.backupDestinations, self.website.domain), 1)
|
||||||
@@ -851,6 +862,7 @@ Subject: %s
|
|||||||
mailUtilities.SendEmail(sender, TO, message)
|
mailUtilities.SendEmail(sender, TO, message)
|
||||||
|
|
||||||
def createBackup(self):
|
def createBackup(self):
|
||||||
|
|
||||||
self.statusPath = self.extraArgs['tempPath']
|
self.statusPath = self.extraArgs['tempPath']
|
||||||
website = self.extraArgs['website']
|
website = self.extraArgs['website']
|
||||||
self.backupDestinations = self.extraArgs['backupDestinations']
|
self.backupDestinations = self.extraArgs['backupDestinations']
|
||||||
@@ -861,6 +873,7 @@ Subject: %s
|
|||||||
### Checking if restic is installed before moving on
|
### Checking if restic is installed before moving on
|
||||||
|
|
||||||
command = 'restic'
|
command = 'restic'
|
||||||
|
|
||||||
if ProcessUtilities.outputExecutioner(command).find('restic is a backup program which') == -1:
|
if ProcessUtilities.outputExecutioner(command).find('restic is a backup program which') == -1:
|
||||||
try:
|
try:
|
||||||
|
|
||||||
|
|||||||
@@ -42,9 +42,10 @@ def main():
|
|||||||
|
|
||||||
numberOfAdministrator = Administrator.objects.count()
|
numberOfAdministrator = Administrator.objects.count()
|
||||||
if numberOfAdministrator == 0:
|
if numberOfAdministrator == 0:
|
||||||
|
|
||||||
ACLManager.createDefaultACLs()
|
ACLManager.createDefaultACLs()
|
||||||
acl = ACL.objects.get(name='admin')
|
acl = ACL.objects.get(name='admin')
|
||||||
token = hashPassword.generateToken('admin', '1234567')
|
token = hashPassword.generateToken('admin', adminPass)
|
||||||
|
|
||||||
email = 'usman@cyberpersons.com'
|
email = 'usman@cyberpersons.com'
|
||||||
admin = Administrator(userName="admin", password=hashPassword.hash_password(adminPass), type=1, email=email,
|
admin = Administrator(userName="admin", password=hashPassword.hash_password(adminPass), type=1, email=email,
|
||||||
|
|||||||
Reference in New Issue
Block a user