mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 14:26:16 +01:00
bug fix: do not allow prohibited characters in oc backups
This commit is contained in:
@@ -1942,6 +1942,16 @@ class BackupManager:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
|
userName = user.userName.lower()
|
||||||
|
|
||||||
|
not_allowed_characters = [
|
||||||
|
' ', '/', '\\', '@', '!', '#', '$', '%', '^', '&', '*', '(', ')', '+', '=',
|
||||||
|
'{', '}', '[', ']', ':', ';', '"', "'", '<', '>', ',', '?', '|', '`', '~'
|
||||||
|
]
|
||||||
|
|
||||||
|
for items in not_allowed_characters:
|
||||||
|
userName = userName.replace(items, '')
|
||||||
|
|
||||||
backup_plan = OneClickBackups(
|
backup_plan = OneClickBackups(
|
||||||
owner=user,
|
owner=user,
|
||||||
planName=plan_name,
|
planName=plan_name,
|
||||||
@@ -1949,7 +1959,7 @@ class BackupManager:
|
|||||||
price=price,
|
price=price,
|
||||||
customer=customer,
|
customer=customer,
|
||||||
subscription=subscription,
|
subscription=subscription,
|
||||||
sftpUser=f'{user.userName}{str(randint(1000, 9999))}',
|
sftpUser=f'{userName}{str(randint(1000, 9999))}',
|
||||||
)
|
)
|
||||||
backup_plan.save()
|
backup_plan.save()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user