mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
better cron validation
This commit is contained in:
parent
630eb27c50
commit
8723a44402
@ -6,7 +6,6 @@ import sys
|
||||
from app.classes.models.server_permissions import Enum_Permissions_Server
|
||||
from app.classes.models.users import helper_users
|
||||
from peewee import DoesNotExist
|
||||
import schedule
|
||||
import yaml
|
||||
import asyncio
|
||||
import shutil
|
||||
|
@ -1112,8 +1112,10 @@ class PanelHandler(BaseHandler):
|
||||
interval_type = ''
|
||||
cron_string = bleach.clean(self.get_argument('cron', ''))
|
||||
sch_id = self.get_argument('sch_id', None)
|
||||
if len(cron_string.split(' ')) != 5:
|
||||
self.redirect("/panel/error?error=INVALID FORMAT: Invalid Cron Format. Cron must have a space between each character and only have a max of 5 characters * * * * *")
|
||||
try:
|
||||
CronValidator.parse(cron_string)
|
||||
except Exception as e:
|
||||
self.redirect("/panel/error?error=INVALID FORMAT: Invalid Cron Format. {}".format(e))
|
||||
return
|
||||
action = bleach.clean(self.get_argument('action', None))
|
||||
if action == "command":
|
||||
|
Loading…
Reference in New Issue
Block a user