remove circular dependencies on SetFELog

This commit is contained in:
2023-04-09 13:21:44 +10:00
parent a84ff49413
commit 5bd925fa5a
2 changed files with 3 additions and 2 deletions

View File

@@ -64,7 +64,6 @@ from files import Entry
from person import Person
from settings import Settings
from user import PAUser
from job import SetFELog
####################################### GLOBALS #######################################
# allow jinja2 to call these python functions directly
@@ -120,6 +119,7 @@ def login():
# the re matches on any special LDAP chars, we dont want someone
# ldap-injecting our username, so send them back to the login page instead
if request.method == 'POST' and re.search( r'[()\\*&!]', request.form['username']):
from job import SetFELog
SetFELog( message=f"ERROR: Detected special LDAP chars in username: {request.form['username']}", log_level="error", persistent=True, cant_close=True )
return redirect(url_for('login'))
if form.validate_on_submit():

View File

@@ -5,7 +5,6 @@ from sqlalchemy import Sequence
from sqlalchemy.exc import SQLAlchemyError
from flask_login import login_required, current_user
from main import db, app, ma
from job import SetFELog
# pylint: disable=no-member
@@ -137,6 +136,7 @@ def settings():
def SettingsRBPath():
settings = Settings.query.first()
if settings == None:
from job import SetFELog
SetFELog( message="Cannot create file data with no settings / recycle bin path is missing", log_level="error", persistent=True, cant_close=False)
return
# path setting is an absolute path, just use it, otherwise prepend base_path first
@@ -154,6 +154,7 @@ def SettingsSPath():
paths=[]
settings = Settings.query.first()
if settings == None:
from job import SetFELog
SetFELog( message="Cannot create file data with no settings / storage path is missing", log_level="error", persistent=True, cant_close=False)
return
if settings.storage_path[0] == '/':