remove circular dependencies on SetFELog
This commit is contained in:
2
main.py
2
main.py
@@ -64,7 +64,6 @@ from files import Entry
|
|||||||
from person import Person
|
from person import Person
|
||||||
from settings import Settings
|
from settings import Settings
|
||||||
from user import PAUser
|
from user import PAUser
|
||||||
from job import SetFELog
|
|
||||||
|
|
||||||
####################################### GLOBALS #######################################
|
####################################### GLOBALS #######################################
|
||||||
# allow jinja2 to call these python functions directly
|
# 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
|
# 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
|
# ldap-injecting our username, so send them back to the login page instead
|
||||||
if request.method == 'POST' and re.search( r'[()\\*&!]', request.form['username']):
|
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 )
|
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'))
|
return redirect(url_for('login'))
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ from sqlalchemy import Sequence
|
|||||||
from sqlalchemy.exc import SQLAlchemyError
|
from sqlalchemy.exc import SQLAlchemyError
|
||||||
from flask_login import login_required, current_user
|
from flask_login import login_required, current_user
|
||||||
from main import db, app, ma
|
from main import db, app, ma
|
||||||
from job import SetFELog
|
|
||||||
|
|
||||||
# pylint: disable=no-member
|
# pylint: disable=no-member
|
||||||
|
|
||||||
@@ -137,6 +136,7 @@ def settings():
|
|||||||
def SettingsRBPath():
|
def SettingsRBPath():
|
||||||
settings = Settings.query.first()
|
settings = Settings.query.first()
|
||||||
if settings == None:
|
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)
|
SetFELog( message="Cannot create file data with no settings / recycle bin path is missing", log_level="error", persistent=True, cant_close=False)
|
||||||
return
|
return
|
||||||
# path setting is an absolute path, just use it, otherwise prepend base_path first
|
# path setting is an absolute path, just use it, otherwise prepend base_path first
|
||||||
@@ -154,6 +154,7 @@ def SettingsSPath():
|
|||||||
paths=[]
|
paths=[]
|
||||||
settings = Settings.query.first()
|
settings = Settings.query.first()
|
||||||
if settings == None:
|
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)
|
SetFELog( message="Cannot create file data with no settings / storage path is missing", log_level="error", persistent=True, cant_close=False)
|
||||||
return
|
return
|
||||||
if settings.storage_path[0] == '/':
|
if settings.storage_path[0] == '/':
|
||||||
|
|||||||
Reference in New Issue
Block a user