diff --git a/.gitignore b/.gitignore index 7bbc71c..47a6925 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,9 @@ __pycache__/ *.py[cod] *$py.class +#image +image/*.jpeg + # C extensions *.so diff --git a/app/config.py b/app/config.py index 0d1afa3..fae21cf 100644 --- a/app/config.py +++ b/app/config.py @@ -30,7 +30,10 @@ if serv is not None: if form.getvalue('serv') is not None and form.getvalue('open') is not None : - funct.logging(serv, "config.py open config") + try: + funct.logging(serv, "config.py open config") + except: + pass funct.get_config(serv, cfg) try: @@ -52,7 +55,11 @@ if form.getvalue('serv') is not None and form.getvalue('open') is not None : os.system("/bin/mv %s %s.old" % (cfg, cfg)) if form.getvalue('serv') is not None and form.getvalue('config') is not None: - funct.logging(serv, "config.py edited config") + try: + funct.logging(serv, "config.py edited config") + except: + pass + config = form.getvalue('config') oldcfg = form.getvalue('oldconfig') save = form.getvalue('save') diff --git a/app/funct.py b/app/funct.py index 0d6b56e..855c8d3 100644 --- a/app/funct.py +++ b/app/funct.py @@ -39,12 +39,14 @@ def get_data(type): return now_utc.strftime(fmt) def logging(serv, action): + import sql dateFormat = "%b %d %H:%M:%S" now_utc = datetime.now(timezone(time_zone)) IP = cgi.escape(os.environ["REMOTE_ADDR"]) cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE")) - login = cookie.get('login') - mess = now_utc.strftime(dateFormat) + " from " + IP + " user: " + login.value + " " + action + " for: " + serv + "\n" + user_uuid = cookie.get('uuid') + login = sql.get_user_name_by_uuid(user_uuid.value) + mess = now_utc.strftime(dateFormat) + " from " + IP + " user: " + login + " " + action + " for: " + serv + "\n" log_path = config.get('main', 'log_path') try: @@ -327,7 +329,12 @@ def ssh_connect(serv, **kwargs): print('